find
FindResult):
| Field | Description |
|---|---|
| results | documents, that matches the filter |
| count | total number of documents, that matches the filter |
| pagesCount | total number of documents, that matches the filter divided by the number of documents per page |
page and perPage params to get a paginated result. Otherwise, all documents will be returned.
Parameters
- filter:
Filter<U>; - readConfig:
ReadConfig& { page?: number; perPage?: number }; - findOptions:
FindOptions;
Promise<FindResult<U>>.
findOne
null if document was not found.
Parameters
- filter:
Filter<U>; - readConfig:
ReadConfig; - findOptions:
FindOptions;
Promise<U | null>.
updateOne
null if document was not found.
Parameters
- filter:
Filter<U>; - updateFilterOrFn:
(doc: U) => Partial<U>|UpdateFilter<U>; Function that accepts current document and returns object containing fields to update. - updateConfig:
UpdateConfig; - updateOptions:
UpdateOptions;
Promise<U | null>.
updateMany
- filter:
Filter<U>; - updateFilterOrFn:
(doc: U) => Partial<U>|UpdateFilter<U>;
Function that accepts current document and returns object containing fields to update. - updateConfig:
UpdateConfig; - updateOptions:
UpdateOptions;
Promise<U[]>.
insertOne
- object:
Partial<U>; - createConfig:
CreateConfig; - insertOneOptions:
InsertOneOptions;
Promise<U>.
insertMany
- objects:
Partial<U>[]; - createConfig:
CreateConfig; - bulkWriteOptions:
BulkWriteOptions;
Promise<U[]>.
deleteSoft
deletedOn field to the documents that match the query and returns them.
Parameters
- filter:
Filter<U>; - deleteConfig:
DeleteConfig; - deleteOptions:
DeleteOptions;
Promise<U[]>.
deleteOne
null if document was not found.
Parameters
- filter:
Filter<U>; - deleteConfig:
DeleteConfig; - deleteOptions:
DeleteOptions;
Promise<U | null>.
deleteMany
- filter:
Filter<U>; - deleteConfig:
DeleteConfig; - deleteOptions:
DeleteOptions;
Promise<U[]>.
replaceOne
- filter:
Filter<T>; - replacement:
Partial<T>; - readConfig:
ReadConfig; - replaceOptions:
ReplaceOptions;
Promise<UpdateResult | Document>.
atomic.updateOne
- filter:
Filter<T>; - updateFilter:
UpdateFilter<T>; - readConfig:
ReadConfig; - updateOptions:
UpdateOptions;
Promise<UpdateResult>.
atomic.updateMany
- filter:
Filter<T>; - updateFilter:
UpdateFilter<T>; - readConfig:
ReadConfig; - updateOptions:
UpdateOptions;
Promise<UpdateResult | Document>.
exists
- filter:
Filter<T>; - readConfig:
ReadConfig; - findOptions:
FindOptions;
Promise<boolean>.
countDocuments
- filter:
Filter<T>; - readConfig:
ReadConfig; - countDocumentOptions:
CountDocumentsOptions;
Promise<number>.
distinct
- key:
string; - filter:
Filter<T>; - readConfig:
ReadConfig; - distinctOptions:
DistinctOptions;
Promise<any[]>.
aggregate
- pipeline:
any[]; - options:
AggregateOptions;
Promise<any[]>.
watch
- pipeline:
Document[] | undefined; - options:
ChangeStreamOptions;
Promise<any>.
drop
- recreate:
boolean; Should create collection after deletion.
Promise<void>.
indexExists
- indexes:
string | string[]; - indexInformationOptions:
IndexInformationOptions;
Promise<string | void>.
createIndex
- indexSpec:
IndexSpecification; - options:
CreateIndexesOptions;
Promise<string | void>.
createIndexes
- indexSpecs:
IndexDescription[]; - options:
CreateIndexesOptions;
Promise<string[] | void>.
dropIndex
- indexName:
string; - options:
DropIndexesOptions;
Promise<void | Document>.
dropIndexes
_id index from a collection.
- options:
DropIndexesOptions;
Promise<void | Document>.