Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • DatabaseSession

Index

Constructors

constructor

  • Parameters

    • connection: Connection
    • Default value disabledInstancePooling: boolean = false

    Returns DatabaseSession

Properties

Protected connection

connection: Connection

disabledInstancePooling

disabledInstancePooling: boolean

entityRegistry

entityRegistry: EntityRegistry = new EntityRegistry()

id

id: number = SESSION_IDS++

Methods

add

  • add<T>(item: T): Promise<boolean>
  • Low level: add one item to the database.

    • Populates primary key if necessary.
    • DOES NOT add references automatically. You have to call on each new reference add() in order to save it.
    • DOES NOT update back-references.
    • No repository events are triggered.

    You should usually work with persist() instead, except if you know what you are doing.

    Type parameters

    • T

    Parameters

    • item: T

    Returns Promise<boolean>

Protected buildAggregationPipeline

  • buildAggregationPipeline(query: BaseQuery<any>): any[]
  • Parameters

    Returns any[]

Protected buildFindCriteria

  • buildFindCriteria<T>(classType: ClassType<T>, item: T): {}
  • Type parameters

    • T

    Parameters

    • classType: ClassType<T>
    • item: T

    Returns {}

    • [name: string]: any

Protected getProjectModel

  • getProjectModel<T>(select: Set<string>): {}
  • Type parameters

    • T

    Parameters

    • select: Set<string>

    Returns {}

    • [name: string]: 0 | 1

Protected getSortFromModel

  • getSortFromModel<T>(modelSort?: SORT<T>): {}
  • Type parameters

    • T

    Parameters

    • Optional modelSort: SORT<T>

    Returns {}

    • [name: string]: -1 | 1 | { $meta: "textScore" }

hydrateEntity

  • hydrateEntity<T>(item: T): Promise<void>
  • Type parameters

    • T

    Parameters

    • item: T

    Returns Promise<void>

query

  • Creates a new DatabaseQuery instance which can be used to query data.

    Type parameters

    • T

    Parameters

    • classType: ClassType<T>

    Returns DatabaseQuery<T>

remove

  • remove<T>(item: T): Promise<boolean>
  • Low level: removes one item from the database that has the given id.

    • DOES NOT remove referenced items. You have to call on each reference delete() in order to remove it.
    • DOES NOT update back-references.
    • No repository events are triggered.

    You should usually work with persist() instead, except if you know what you are doing.

    Type parameters

    • T

    Parameters

    • item: T

    Returns Promise<boolean>

resolveQueryFetcher

  • Type parameters

    • T

    Parameters

    Returns Promise<any>

resolveQueryModifier

  • Type parameters

    • T

    Parameters

    Returns Promise<void>

update

  • update<T>(item: T): Promise<boolean>
  • Low level: updates one item in the database.

    • DOES NOT update referenced items. You have to call on each changed reference update() in order to save it.
    • DOES NOT update back-references when primary key changes.
    • No repository events are triggered.

    You should usually work with persist() instead, except if you know what you are doing.

    Type parameters

    • T

    Parameters

    • item: T

    Returns Promise<boolean>

Generated using TypeDoc