Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface InstanceInternals<TDocument, TInstance>

Type parameters

  • TDocument: object

  • TInstance

Hierarchy

  • InstanceInternals

Index

Properties

_fieldCache

_fieldCache: FieldCache

Used to provide post-transform object memoization on a per-field basis See #118 for design details

_isNew

_isNew: boolean

Whether this instance is known to be present in the database or not

_isPartial

_isPartial: boolean

Whether this instance represents a partial document

_model

_model: Model<TDocument, TInstance>

The model that this instance belongs to

_modified

_modified: TDocument

A copy of the original document which may have had changes applied to it

_original

_original: TDocument

The original document received from the database

Methods

_getField

  • _getField<K, V>(field: K): V
  • Allows an instance implementation to define its own means of accessing properties. This is used to enable the memoization of transformed properties.

    Type parameters

    • K: keyof TInstance

    • V: TInstance[K]

    Parameters

    • field: K

      The name of the schema field whose value should be returned

    Returns V

_setField

  • _setField<K, V>(field: K, value: V): void
  • Allows an instance implementation to control how it responds when new values are assigned to any of its fields. This is used to support memoization of transformed properties safely.

    Type parameters

    • K: keyof TInstance

    • V: TInstance[K]

    Parameters

    • field: K

      The name of the schema field whose value should be updated

    • value: V

      The pre-toDB-transform value to be assigned to this field

    Returns void

Generated using TypeDoc