Options
All
  • Public
  • Public/Protected
  • All
Menu

Entity manager supposed to work with any entity, automatically find its repository and call its methods, whatever entity type are you passing.

This implementation is used for MongoDB driver which has some specifics in its EntityManager.

Hierarchy

Index

Constructors

constructor

Properties

connection

connection: Connection

Connection used by this entity manager.

Protected plainObjectToEntityTransformer

plainObjectToEntityTransformer: PlainObjectToNewEntityTransformer = new PlainObjectToNewEntityTransformer()

Plain to object transformer used in create and merge operations.

Protected repositories

repositories: Repository<any>[] = []

Once created and then reused by en repositories.

Accessors

queryRunner

Methods

aggregate

aggregateEntity

Protected applyEntityTransformationToCursor

bulkWrite

clear

collectionIndexExists

  • collectionIndexExists<Entity>(entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string, indexes: string | string[]): Promise<boolean>

collectionIndexInformation

  • collectionIndexInformation<Entity>(entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string, options?: undefined | object): Promise<any>

collectionIndexes

  • collectionIndexes<Entity>(entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string): Promise<any>

Protected convertFindManyOptionsOrConditionsToMongodbQuery

  • convertFindManyOptionsOrConditionsToMongodbQuery<Entity>(optionsOrConditions: FindManyOptions<Entity> | Partial<Entity> | undefined): ObjectLiteral | undefined

Protected convertFindOneOptionsOrConditionsToMongodbQuery

  • convertFindOneOptionsOrConditionsToMongodbQuery<Entity>(optionsOrConditions: FindOneOptions<Entity> | Partial<Entity> | undefined): ObjectLiteral | undefined

Protected convertFindOptionsOrderToOrderCriteria

Protected convertMixedCriteria

count

create

createCollectionIndex

createCollectionIndexes

createCursor

createEntityCursor

createQueryBuilder

decrement

delete

deleteMany

deleteOne

distinct

dropCollectionIndex

dropCollectionIndexes

  • dropCollectionIndexes<Entity>(entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string): Promise<any>

find

findAndCount

  • findAndCount<Entity>(entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string, optionsOrConditions?: FindManyOptions<Entity> | Partial<Entity>): Promise<[Entity[], number]>

findByIds

  • findByIds<Entity>(entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string, ids: any[], optionsOrConditions?: FindManyOptions<Entity> | Partial<Entity>): Promise<Entity[]>

findOne

findOneAndDelete

findOneAndReplace

findOneAndUpdate

findOneOrFail

geoHaystackSearch

geoNear

getCustomRepository

  • getCustomRepository<T>(customRepository: ObjectType<T>): T

getId

  • getId(entity: any): any
  • getId(target: Function | string, entity: any): any

getMongoRepository

getRepository

  • Gets repository for the given entity class or name. If single database connection mode is used, then repository is obtained from the repository aggregator, where each repository is individually created for this entity manager. When single database connection is not used, repository is being obtained from the connection.

    Type parameters

    • Entity

    Parameters

    Returns Repository<Entity>

getTreeRepository

  • Gets tree repository for the given entity class or name. If single database connection mode is used, then repository is obtained from the repository aggregator, where each repository is individually created for this entity manager. When single database connection is not used, repository is being obtained from the connection.

    Type parameters

    • Entity

    Parameters

    Returns TreeRepository<Entity>

group

  • group<Entity>(entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string, keys: Object | Array<any> | Function | Code, condition: Object, initial: Object, reduce: Function | Code, finalize: Function | Code, command: boolean, options?: undefined | object): Promise<any>
  • Run a group command across a collection.

    Type parameters

    • Entity

    Parameters

    • entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string
    • keys: Object | Array<any> | Function | Code
    • condition: Object
    • initial: Object
    • reduce: Function | Code
    • finalize: Function | Code
    • command: boolean
    • Optional options: undefined | object

    Returns Promise<any>

hasId

  • hasId(entity: any): boolean
  • hasId(target: Function | string, entity: any): boolean

increment

initializeOrderedBulkOp

initializeUnorderedBulkOp

insert

insertMany

insertOne

isCapped

listCollectionIndexes

mapReduce

merge

parallelCollectionScan

preload

  • Creates a new entity from the given plan javascript object. If entity already exist in the database, then it loads it (and everything related to it), replaces all values with the new ones from the given object and returns this new entity. This new entity is actually a loaded from the db entity with all properties replaced from the new object.

    Type parameters

    • Entity

    Parameters

    Returns Promise<Entity | undefined>

query

  • query(query: string, parameters?: any[]): Promise<any>

reIndex

  • Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.

    Type parameters

    • Entity

    Parameters

    Returns Promise<any>

release

  • release(): Promise<void>
  • Releases all resources used by entity manager. This is used when entity manager is created with a single query runner, and this single query runner needs to be released after job with entity manager is done.

    Returns Promise<void>

remove

rename

  • Reindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.

    Type parameters

    • Entity

    Parameters

    • entityClassOrName: ObjectType<Entity> | EntitySchema<Entity> | string
    • newName: string
    • Optional options: undefined | object

    Returns Promise<Collection>

replaceOne

save

stats

transaction

  • transaction<T>(runInTransaction: function): Promise<T>
  • transaction<T>(isolationLevel: IsolationLevel, runInTransaction: function): Promise<T>

update

updateMany

updateOne

Generated using TypeDoc