Readonly
databaseReadonly
serviceThe name of the collection.
Runs an aggregation framework pipeline against this collection.
An array of aggregation pipeline stages.
A promise that resolves to the aggregation result.
Counts the number of documents in this collection matching the provided filter.
Note: When calling this without a filter, you may receive inaccurate document counts as it returns results based on the collection's metadata, which may result in an approximate count. In particular:
Optional
filter: FilterAn optional filter applied to narrow down the results.
Optional
options: CountOptionsAdditional options to apply.
A promise that resolves to the number of documents matching the filter.
Deletes multiple documents.
Optional
filter: FilterA filter applied to narrow down the result. If omitted, it defaults
to {}
which deletes all documents in the collection.
A promise that resolves to an object containing the number of deleted documents (deletedCount
).
Deletes a single matching document from the collection.
Optional
filter: FilterA filter applied to narrow down the result.
A promise that resolves to an object containing the number of deleted documents (deletedCount
).
Finds the documents which match the provided query.
Optional
filter: FilterAn optional filter applied to narrow down the results.
Optional
options: FindOptionsAdditional options to apply.
A promise that resolves to the found documents.
Finds a document which matches the provided filter.
Optional
filter: FilterA filter applied to narrow down the result.
Optional
options: FindOneOptionsAdditional options to apply.
A promise that resolves to the found document.
Finds a document which matches the provided filter and deletes it
Optional
filter: FilterA filter applied to narrow down the result.
Optional
options: FindOneOptionsAdditional options to apply.
A promise that resolves to the found document before deletion.
Finds a document which matches the provided filter and replaces it with a new document.
A filter applied to narrow down the result.
The new replacing document.
Optional
options: FindOneAndModifyOptionsAdditional options to apply.
A promise that resolves to the found document found before replacement.
Finds a document which matches the provided query and performs the desired update to individual fields.
A filter applied to narrow down the result.
The new values for the document.
Optional
options: FindOneAndModifyOptionsAdditional options to apply.
A promise that resolves to the found document before applying the update.
Inserts an array of documents into the collection. If any values are missing identifiers, they will be generated by the server.
The array of documents to insert.
A promise that resolves to an object containing an array of IDs inserted (insertedIds
).
Inserts a single document into the collection. Note: If the document is missing an _id, one will be generated for it by the server.
The document to insert.
A promise that resolves an object containing the inserted object ID (insertedId
).
Updates multiple documents matching the provided filter in this collection.
A filter applied to narrow down the result.
The new values for the documents.
Optional
options: UpdateOptionsAdditional options to apply.
A promise that resolves to an object containing:
{
matchedCount: number;
modifiedCount: number;
upsertedId: IdType | undefined;
}
Updates a single document matching the provided filter in this collection.
A filter applied to narrow down the result.
The new values for the document.
Optional
options: UpdateOptionsAdditional options to apply.
A promise that resolves to an object containing:
{
matchedCount: number;
modifiedCount: number;
upsertedId: IdType | undefined;
}
Creates an asynchronous change stream to monitor this collection for changes.
By default, yields all change events for this collection. You may specify at most one of
the filter
or ids
options.
Important Note: To use this on React Native, you must install:
fetch
and ReadableStream
: https://www.npmjs.com/package/react-native-polyfill-globalsAn async generator of change events.
Generated using TypeDoc
A remote collection of documents in a MongoDB database.