Service API reference
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<U>
;ReadConfig
& { page?: number; perPage?: number }
;FindOptions
;Promise<FindResult<U>>
.
findOne
null
if document was not found.
Parameters
Filter<U>
;ReadConfig
;FindOptions
;Promise<U | null>
.
updateOne
null
if document was not found.
Parameters
Filter<U>
;(doc: U) => Partial<U>
;UpdateConfig
;UpdateOptions
;Promise<U | null>
.
updateMany
Filter<U>
;(doc: U) => Partial<U>
;UpdateConfig
;UpdateOptions
;Promise<U[]>
.
insertOne
Partial<U>
;CreateConfig
;InsertOneOptions
;Promise<U>
.
insertMany
Partial<U>[]
;CreateConfig
;BulkWriteOptions
;Promise<U[]>
.
deleteSoft
deletedOn
field to the documents that match the query and returns them.
Parameters
Filter<U>
;DeleteConfig
;DeleteOptions
;Promise<U[]>
.
deleteOne
null
if document was not found.
Parameters
Filter<U>
;DeleteConfig
;DeleteOptions
;Promise<U | null>
.
deleteMany
Filter<U>
;DeleteConfig
;DeleteOptions
;Promise<U[]>
.
replaceOne
Filter<T>
;Partial<T>
;ReadConfig
;ReplaceOptions
;Promise<
UpdateResult |
Document>
.
atomic.updateOne
Filter<T>
;UpdateFilter<T>
;ReadConfig
;UpdateOptions
;Promise<
UpdateResult>
.
atomic.updateMany
Filter<T>
;UpdateFilter<T>
;ReadConfig
;UpdateOptions
;Promise<
UpdateResult |
Document>
.
exists
Filter<T>
;ReadConfig
;FindOptions
;Promise<boolean>
.
countDocuments
Filter<T>
;ReadConfig
;CountDocumentsOptions
;Promise<number>
.
distinct
string
;Filter<T>
;ReadConfig
;DistinctOptions
;Promise<any[]>
.
aggregate
any[]
;AggregateOptions
;Promise<any[]>
.
watch
Document[] | undefined
;ChangeStreamOptions
;Promise<any>
.
drop
boolean
;
Should create collection after deletion.Promise<void>
.
indexExists
string | string[]
;IndexInformationOptions
;Promise<string | void>
.
createIndex
IndexSpecification
;CreateIndexesOptions
;Promise<string | void>
.
createIndexes
IndexDescription[]
;CreateIndexesOptions
;Promise<string[] | void>
.
dropIndex
string
;DropIndexesOptions
;Promise<void | Document>
.
dropIndexes
_id
index from a collection.
DropIndexesOptions
;Promise<void | Document>
.