可选queryRunner: QueryRunner只读managerEntity Manager used by this repository.
可选 只读queryQuery runner provider used for this repository.
只读targetEntity target that is managed by this repository. If this repository manages entity from schema, then it returns a name of that schema instead.
Entity metadata of the entity current repository manages.
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: AggregateOptionsReturn 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/collection (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: { full: boolean }Count 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: ObjectLiteral可选options: CountOptionsCount number of matching documents in the db to a query.
可选query: ObjectLiteral可选options: CountDocumentsOptionsCreates a new entity instance.
Creates new entities and copies all entity properties from given objects into their new entities. Note that it copies only properties that are present in entity schema.
Creates a new entity instance and copies all entity properties from this object into a new entity. Note that it copies only properties that are present in entity schema.
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.
Creates 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.
Using Query Builder with MongoDB is not supported yet. Calling this method will return an error.
可选queryRunner: QueryRunnerDecrements some column by provided value of the entities matched given conditions.
Deletes entities by a given criteria. 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.
Checks whether any entity exists that matches the given options.
可选options: FindManyOptions<Entity>Checks whether any entity exists that matches the given options.
可选options: FindManyOptions<Entity>Checks whether any entity exists that matches the given conditions.
Extends repository with provided functions.
Finds entities that match given find options or conditions.
可选options: 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).
Finds entities by ids. Optionally find options can be applied.
可选options: anyFind 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 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.
Checks if entity has an id. If entity composite compose ids, it will check them all.
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.
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 multiple entities (or entity-like objects) into a given 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.
Note that given entity-like object must have an entity id / primary key to find entity by. Returns undefined if entity with given id was not found.
Raw SQL query execution is not supported by MongoDB. Calling this method will return an error.
可选parameters: any[]Recovers all given entities in the database.
Recovers all given entities in the database.
可选options: SaveOptionsRecovers a given entity in the database.
Recovers a given entity in the database.
可选options: SaveOptionsRemoves a given entities 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: { dropTarget?: boolean }Replace a document on MongoDB.
可选options: ReplaceOptionsRestores entities by a given criteria. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient SOFT-DELETE query. Does not check if entity exist in the database.
Saves 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 criteria. Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient SOFT-DELETE query. Does not check if entity exist in the database.
Records the delete date of all given entities.
Records the delete date of all given entities.
可选options: SaveOptionsRecords the delete date of a given entity.
Records the delete date of a given entity.
可选options: SaveOptionsReturn the SUM of a column
可选where: FindOptionsWhere<Entity> | FindOptionsWhere<Entity>[]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: UpdateOptionsInserts a given entity into the database, unless a unique constraint conflicts then updates the entity Unlike save method executes a primitive operation without cascades, relations and other operations included. Executes fast and efficient INSERT ... ON CONFLICT DO UPDATE/ON DUPLICATE KEY UPDATE query.
Repository used to manage mongodb documents of a single entity type.