Attaches a callback for only the rejection of the Promise.
Optionalonrejected: ((reason: any) => TResult | PromiseLike<TResult>) | nullThe callback to execute when the Promise is rejected.
A Promise for the completion of the callback.
Executes the aggregation returning a Promise which will be
resolved with .finally() chained.
Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
Optionalonfinally: (() => void) | nullThe callback to execute when the Promise is settled (fulfilled or rejected).
A Promise for the completion of the callback.
Provides promise for aggregate.
Attaches callbacks for the resolution and/or rejection of the Promise.
Optionalonfulfilled: ((value: A[]) => TResult1 | PromiseLike<TResult1>) | nullThe callback to execute when the Promise is resolved.
Optionalonrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | nullThe callback to execute when the Promise is rejected.
A Promise for the completion of which ever callback is executed.
Returns an asyncIterator for use with for/await/of loops
You do not need to call this function explicitly, the JavaScript runtime
will call it for you.
Appends a new $addFields operator to this aggregate pipeline. Requires MongoDB v3.4+ to work
Sets the allowDiskUse option for the aggregation query
Appends new operators to this aggregate pipeline
Set the collation.
Appends a new $count operator to this aggregate pipeline.
Sets the cursor option for the aggregation query
Optionaloptions: Record<string, unknown>Appends a new $densify operator to this aggregate pipeline
Executes the aggregate pipeline on the currently bound Model.
OptionalcursorOptions: Record<string, unknown>Execute the aggregation with explain
Execute the aggregation with explain
Combines multiple aggregation pipelines.
Appends a new $fill operator to this aggregate pipeline
Appends new custom $graphLookup operator(s) to this aggregate pipeline, performing a recursive search on a collection.
Appends new custom $group operator to this aggregate pipeline.
Sets the hint option for the aggregation query
Appends a new $limit operator to this aggregate pipeline.
maximum number of records to pass to the next stage
Appends new custom $lookup operator to this aggregate pipeline.
Appends a new custom $match operator to this aggregate pipeline.
$match operator contents
Appends a new $geoNear operator to this aggregate pipeline.
OptionaldistanceMultiplier?: numberOptionalincludeLocs?: stringOptionalkey?: stringOptionalmaxDistance?: numberOptionalminDistance?: numberOptionalnum?: numberDeprecated. Use only with MondoDB below 4.2 (removed in 4.2)
Optionalquery?: AnyObjectOptionalspherical?: booleanLets you set arbitrary options, for middlewares or plugins.
Returns the current pipeline
Appends a new $project operator to this aggregate pipeline.
Sets the readPreference option for the aggregation query.
Sets the readConcern level for the aggregation query.
Appends a new $redact operator to this aggregate pipeline.
Appends a new $replaceRoot operator to this aggregate pipeline.
Appends new custom $sample operator to this aggregate pipeline.
Helper for Atlas Text Search's
$search stage.
Sets the session for this aggregation. Useful for transactions.
Appends a new $skip operator to this aggregate pipeline.
number of records to skip before next stage
Appends a new $sort operator to this aggregate pipeline.
Appends a new $sortByCount operator to this aggregate pipeline. Accepts either a string field name or a pipeline object.
Appends new $unionWith operator to this aggregate pipeline.
Appends new custom $unwind operator(s) to this aggregate pipeline.
Executes the query returning a
Promisewhich will be resolved with either the doc(s) or rejected with the error. Like.then(), but only takes a rejection handler.