Skip to main content
Version: 6.4

MongoDriver

Hierarchy

Index

Constructors

constructor

Properties

[EntityManagerType]

[EntityManagerType]: MongoEntityManager<MongoDriver>

readonlyinheritedconfig

Methods

aggregate

  • aggregate(entityName: string, pipeline: any[], ctx?: ClientSession): Promise<any[]>
  • Parameters

    • entityName: string
    • pipeline: any[]
    • optionalctx: ClientSession

    Returns Promise<any[]>

inheritedclose

  • close(force?: boolean): Promise<void>
  • Parameters

    • optionalforce: boolean

    Returns Promise<void>

inheritedconnect

inheritedconvertException

  • Converts native db errors to standardized driver exceptions


    Parameters

    • exception: Error

    Returns DriverException

count

  • count(entityName: string, where: FilterQuery<T>, options?: CountOptions<T, never>, ctx?: ClientSession): Promise<number>
  • Parameters

    Returns Promise<number>

inheritedcountVirtual

  • Parameters

    Returns Promise<number>

createEntityManager

  • Parameters

    • optionaluseContext: boolean

    Returns D[typeof EntityManagerType]

find

  • Finds selection of entities


    Parameters

    Returns Promise<EntityData<T>[]>

findOne

  • Finds single entity (table row, document)


    Parameters

    Returns Promise<null | EntityData<T>>

findVirtual

inheritedgetConnection

inheritedgetDependencies

  • getDependencies(): string[]
  • Returns name of the underlying database dependencies (e.g. mongodb or mysql2) for SQL drivers it also returns knex in the array as connectors are not used directly there


    Returns string[]

inheritedgetMetadata

getPlatform

inheritedloadFromPivotTable

  • loadFromPivotTable(prop: EntityProperty<any, any>, owners: (O extends { [PrimaryKeyProp]?: PK } ? PK extends keyof O<O> ? ReadonlyPrimary<UnwrapPrimary<O<O>[PK<PK>]>> : PK extends keyof O<O>[] ? ReadonlyPrimary<PrimaryPropToType<O<O>, PK<PK>>> : PK : O extends { _id?: PK } ? string | ReadonlyPrimary<PK> : O extends { uuid?: PK } ? ReadonlyPrimary<PK> : O extends { id?: PK } ? ReadonlyPrimary<PK> : O)[][], where?: any, orderBy?: OrderDefinition<T>, ctx?: any, options?: FindOptions<T, any, any, any>, pivotJoin?: boolean): Promise<Dictionary<T[]>>
  • When driver uses pivot tables for M:N, this method will load identifiers for given collections from them


    Parameters

    • prop: EntityProperty<any, any>
    • owners: (O extends { [PrimaryKeyProp]?: PK } ? PK extends keyof O<O> ? ReadonlyPrimary<UnwrapPrimary<O<O>[PK<PK>]>> : PK extends keyof O<O>[] ? ReadonlyPrimary<PrimaryPropToType<O<O>, PK<PK>>> : PK : O extends { _id?: PK } ? string | ReadonlyPrimary<PK> : O extends { uuid?: PK } ? ReadonlyPrimary<PK> : O extends { id?: PK } ? ReadonlyPrimary<PK> : O)[][]
    • optionalwhere: any
    • optionalorderBy: OrderDefinition<T>
    • optionalctx: any
    • optionaloptions: FindOptions<T, any, any, any>
    • optionalpivotJoin: boolean

    Returns Promise<Dictionary<T[]>>

inheritedlockPessimistic

  • lockPessimistic(entity: T, options: LockOptions): Promise<void>
  • Parameters

    Returns Promise<void>

inheritedmapResult

nativeDelete

  • nativeDelete(entityName: string, where: FilterQuery<T>, options?: { ctx?: ClientSession }): Promise<QueryResult<T>>
  • Parameters

    • entityName: string
    • where: FilterQuery<T>
    • options: { ctx?: ClientSession } = {}
      • optionalctx: ClientSession

    Returns Promise<QueryResult<T>>

nativeInsert

nativeInsertMany

nativeUpdate

nativeUpdateMany

inheritedreconnect

inheritedsetMetadata

  • Parameters

    Returns void

inheritedsyncCollections

  • Parameters

    Returns Promise<void>