只读@instanceof只读connectionConnection used by this entity manager.
受保护plainPlain to object transformer used in create and merge operations.
可选 只读queryCustom query runner to be used for operations in this entity manager. Used only in non-global entity manager.
受保护repositoriesOnce created and then reused by repositories. Created as a future replacement for the #repositories to provide a bit more perf optimization.
受保护treeOnce created and then reused by repositories.
Execute an aggregation framework pipeline against the collection.
可选options: AggregateOptionsExecute an aggregation framework pipeline against the collection. This returns modified version of cursor that transforms each result into Entity model.
可选options: AggregateOptions受保护applyOverrides cursor's toArray and next methods to convert results to entity automatically.
Return the AVG of a column
可选where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]Perform a bulkWrite operation without a fluent API.
可选options: BulkWriteOptionsClears all the data from the given table (truncates/drops it).
Note: this method uses TRUNCATE and may not work as you expect in transactions on some platforms.
Retrieve all the indexes on the collection.
Retrieve all the indexes on the collection.
Retrieves this collections index info.
可选options: IndexInformationOptions受保护convertConverts FindManyOptions to mongodb query.
受保护convert受保护convert受保护convertConverts FindOptions into mongodb select by criteria.
受保护convertCount number of matching documents in the db to a query.
可选query: Filter<Document>可选options: CountOptionsCount number of matching documents in the db to a query.
可选query: ObjectLiteral可选options: CountOptionsCount number of matching documents in the db to a query.
可选query: Filter<Document>可选options: CountDocumentsOptionsCreates a new entity instance and copies all entity properties from this object into a new entity. Note that it copies only properties that present in entity schema.
可选plainObject: EntityLikeCreates a new entities and copies all entity properties from given objects into their new entities. Note that it copies only properties that present in entity schema.
可选plainObjects: EntityLike[]Creates an index on the db and collection.
可选options: CreateIndexesOptionsCreates multiple indexes in the collection, this method is only supported for MongoDB 2.6 or higher. Earlier version of MongoDB will throw a command not supported error. Index specifications are defined at http://docs.mongodb.org/manual/reference/command/createIndexes/.
Creates a cursor for a query that can be used to iterate over results from MongoDB.
可选query: ObjectLiteralCreates a cursor for a query that can be used to iterate over results from MongoDB. This returns modified version of cursor that transforms each result into Entity model.
可选query: ObjectLiteralCreates a new query builder that can be used to build a SQL query.
可选queryRunner: QueryRunnerCreates a new query builder that can be used to build a SQL query.
可选queryRunner: QueryRunnerDecrements some column by provided value of the entities matched given conditions.
Deletes entities by a given conditions. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient DELETE query. Does not check if entity exist in the database.
Delete multiple documents on MongoDB.
可选options: DeleteOptionsDelete a document on MongoDB.
可选options: DeleteOptionsThe distinct command returns returns a list of distinct values for the given key across a collection.
可选options: CommandOperationOptionsDrops an index from this collection.
可选options: CommandOperationOptionsDrops all indexes from the collection.
受保护execute可选optionsOrConditions: any[] | MongoFindManyOptions<Entity> | Partial<Entity>Finds entities that match given find options or conditions.
可选optionsOrConditions: MongoFindManyOptions<Entity> | Partial<Entity>受保护executeFinds first entity that matches given conditions and/or find options.
可选optionsOrConditions: any可选maybeOptions: MongoFindOneOptions<Entity>Checks whether any entity exists with the given options.
可选options: FindManyOptions<Entity>Checks whether any entity exists with the given conditions.
受保护filterFinds entities that match given find options or conditions.
可选optionsOrConditions: FindManyOptions<Entity> | Partial<Entity> | FilterOperators<Entity>Finds entities that match given find options or conditions. Also counts all entities that match given conditions, but ignores pagination settings (from and take options).
可选options: MongoFindManyOptions<Entity>Finds entities that match given where conditions.
Finds entities that match given find options.
Finds entities by ids. Optionally find options can be applied.
可选optionsOrConditions: FindManyOptions<Entity> | Partial<Entity>Finds first entity that matches given conditions and/or find options.
Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.
可选options: FindOneAndDeleteOptionsFind a document and replace it in one atomic operation, requires a write lock for the duration of the operation.
可选options: FindOneAndReplaceOptionsFind a document and update it in one atomic operation, requires a write lock for the duration of the operation.
可选options: FindOneAndUpdateOptionsFinds first entity that matches given WHERE conditions.
Finds entity that matches given id.
Finds first entity that matches given where condition. If entity was not found in the database - rejects with error.
Finds first entity by a given find options. If entity was not found in the database - rejects with error.
Gets entity mixed id.
Gets mongodb repository for the given entity class.
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.
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.
Checks if entity has an id.
Checks if entity of given schema name has an id.
Increments some column by provided value of the entities matched given conditions.
Initiate an In order bulk write operation, operations will be serially executed in the order they are added, creating a new operation for each switch in types.
可选options: BulkWriteOptionsInitiate a Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order.
可选options: BulkWriteOptionsInserts a given entity into the database. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient INSERT query. Does not check if entity exist in the database, so query will fail if duplicate entity is being inserted. You can execute bulk inserts using this method.
Inserts an array of documents into MongoDB.
可选options: BulkWriteOptionsInserts a single document into MongoDB.
可选options: InsertOneOptionsReturns if the collection is a capped collection.
Get the list of all indexes information for the collection.
可选options: ListIndexesOptionsReturn the MAX of a column
可选where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]Merges two entities into one new entity.
Return the MIN of a column
可选where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]Creates a new entity from the given plain 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.
Executes raw SQL query and returns raw database results.
可选parameters: any[]Official docs for examples.
Recovers all given entities.
可选options: SaveOptionsRecovers all given entities.
可选options: SaveOptionsRecovers a given entity.
可选options: SaveOptionsReleases 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.
Removes a given entity from the database.
可选options: RemoveOptionsRemoves a given entity from the database.
可选options: RemoveOptionsRemoves a given entity from the database.
可选options: RemoveOptionsRemoves a given entity from the database.
可选options: RemoveOptionsReindex all indexes on the collection Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections.
可选options: RenameOptionsReplace a document on MongoDB.
可选options: ReplaceOptionsRestores entities by a given condition(s). Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient DELETE query. Does not check if entity exist in the database. Condition(s) cannot be empty.
Saves all given entities in the database. If entities do not exist in the database then inserts, otherwise updates.
可选options: SaveOptionsSaves all given entities in the database. If entities do not exist in the database then inserts, otherwise updates.
可选options: SaveOptionsSaves all given entities in the database. If entities do not exist in the database then inserts, otherwise updates.
Saves all given entities in the database. If entities do not exist in the database then inserts, otherwise updates.
可选options: SaveOptionsSaves a given entity in the database. If entity does not exist in the database then inserts, otherwise updates.
Saves a given entity in the database. If entity does not exist in the database then inserts, otherwise updates.
可选options: SaveOptionsRecords the delete date of entities by a given condition(s). Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient DELETE query. Does not check if entity exist in the database. Condition(s) cannot be empty.
Records the delete date of all given entities.
可选options: SaveOptionsRecords the delete date of a given entity.
可选options: SaveOptionsRecords the delete date of all given entities.
可选options: SaveOptionsRecords the delete date of a given entity.
可选options: SaveOptionsGet all the collection statistics.
可选options: CollStatsOptionsReturn the SUM of a column
可选where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]Wraps given function execution (and all operations made there) in a transaction. All database operations must be executed using provided entity manager.
Wraps given function execution (and all operations made there) in a transaction. All database operations must be executed using provided entity manager.
Updates entity partially. Entity can be found by a given conditions. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient UPDATE query. Does not check if entity exist in the database.
Update multiple documents on MongoDB.
可选options: UpdateOptionsUpdate a single document on MongoDB.
可选options: UpdateOptions可选pipeline: Document[]可选options: ChangeStreamOptionsCreates a new repository instance out of a given Repository and sets current EntityManager instance to it. Used to work with custom repositories in transactions.
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.