Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PropertyTransform<T>

Converts the value of a property to and from its database representation.

Type parameters

  • T

Hierarchy

  • PropertyTransform

Index

Methods

Methods

fromDB

  • fromDB(value: T, property: string, model: Model<any, any>): any
  • Converts a property's value from its database representation into one suitable for the application.

    Parameters

    • value: T

      The value stored in the MongoDB database document.

    • property: string

      The name of the document property to which this transform is being applied.

    • model: Model<any, any>

      The Iridium Model on which this transform is being applied

    Returns any

    A derived value which is more useful to the application.

toDB

  • toDB(value: any, property: string, model: Model<any, any>): T
  • Converts a property's value into a representation more suitable for the database.

    Parameters

    • value: any

      The value used by the application.

    • property: string

      The name of the document property to which this transform is being applied.

    • model: Model<any, any>

      The Iridium Model on which this transform is being applied

    Returns T

    The database optimized representation of the value.

Generated using TypeDoc