Optional onrejected: ((reason) => TResult | PromiseLike<TResult>)Optional
Executes the query returning a Promise which will be
resolved with .finally() chained.
Optional onfinally: (() => void)Optional
The model this query was created from
Executes the query returning a Promise which will be
resolved with either the doc(s) or rejected with the error.
Optional onfulfilled: ((value) => TResult1 | PromiseLike<TResult1>)Optional
Optional onrejected: ((reason) => TResult2 | PromiseLike<TResult2>)Optional
Returns a wrapper around a mongodb driver cursor.
A QueryCursor exposes a Streams3 interface, as well as a .next() function.
This is equivalent to calling .cursor() with no arguments.
Specifies an $all query condition. When called with one argument, the most recent path passed to where() is used.
Specifies arguments for an $and condition.
Specifies a $box condition
Specifies a $center or $centerSphere condition.
Adds a collation to this op (MongoDB 3.4 and up)
Specifies this query as a count query.
Optional criteria: FilterQuery<RawDocType>Optional Specifies this query as a countDocuments query.
Optional criteria: FilterQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Returns a wrapper around a mongodb driver cursor.
A QueryCursor exposes a Streams3 interface, as well as a .next() function.
Optional options: mongoose.QueryOptions<DocType>Optional Declare and/or execute this query as a deleteMany() operation. Works like
remove, except it deletes every document that matches filter in the
collection, regardless of the value of single.
Optional filter: FilterQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Declare and/or execute this query as a deleteOne() operation. Works like
remove, except it deletes at most one document regardless of the single
option.
Optional filter: FilterQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Creates a distinct query: returns the distinct values of the given field that match filter.
Optional filter: FilterQuery<RawDocType>Optional Specifies a $elemMatch query condition. When called with one argument, the most recent path passed to where() is used.
Gets/sets the error flag on this query. If this flag is not null or
undefined, the exec() promise will reject without executing.
Creates a estimatedDocumentCount query: counts the number of documents in the collection.
Optional options: mongoose.QueryOptions<DocType>Optional Specifies a $exists query condition. When called with one argument, the most recent path passed to where() is used.
Sets the explain option,
which makes this query return detailed execution stats instead of the actual
query result. This method is useful for determining what index your queries
use.
Optional verbose: ExplainVerbosityLikeOptional Creates a find query: gets a list of documents that match filter.
Optional projection: ProjectionType<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Optional projection: ProjectionType<RawDocType>Optional Declares the query a findById operation. When executed, returns the document with the given _id.
Optional projection: ProjectionType<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Optional projection: ProjectionType<RawDocType>Optional Creates a findByIdAndDelete query, filtering by the given _id.
Optional id: anyOptional Optional options: mongoose.QueryOptions<DocType>Optional Creates a findOneAndUpdate query, filtering by the given _id.
Optional id: anyOptional Optional update: UpdateQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Declares the query a findOne operation. When executed, returns the first found document.
Optional filter: FilterQuery<RawDocType>Optional Optional projection: ProjectionType<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Optional filter: FilterQuery<RawDocType>Optional Optional projection: ProjectionType<RawDocType>Optional Optional filter: FilterQuery<RawDocType>Optional Creates a findOneAndDelete query: atomically finds the given document, deletes it, and returns the document as it was before deletion.
Optional filter: FilterQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Creates a findOneAndRemove query: atomically finds the given document and deletes it.
Optional filter: FilterQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Creates a findOneAndUpdate query: atomically find the first document that matches filter and apply update.
Optional filter: FilterQuery<RawDocType>Optional Optional update: UpdateQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Returns the current query filter (also known as conditions) as a POJO.
Gets query options.
Returns the current query filter. Equivalent to getFilter().
Returns the current update operations as a JSON object.
Specifies a $gt query condition. When called with one argument, the most recent path passed to where() is used.
Specifies a $gte query condition. When called with one argument, the most recent path passed to where() is used.
Specifies an $in query condition. When called with one argument, the most recent path passed to where() is used.
Sets the lean option.
Optional val: anyOptional Specifies a $lt query condition. When called with one argument, the most recent path passed to where() is used.
Specifies a $lte query condition. When called with one argument, the most recent path passed to where() is used.
Specifies an $maxDistance query condition. When called with one argument, the most recent path passed to where() is used.
Sets the maxTimeMS
option. This will tell the MongoDB server to abort if the query or write op
has been running for more than ms milliseconds.
Merges another Query or conditions object into this one.
Specifies a $mod condition, filters documents for documents whose path property is a number that is equal to remainder modulo divisor.
Getter/setter around the current mongoose-specific options for this query Below are the current Mongoose-specific options.
Optional val: MongooseQueryOptions<unknown>Optional Specifies a $ne query condition. When called with one argument, the most recent path passed to where() is used.
Specifies a $near or $nearSphere condition
Specifies an $nin query condition. When called with one argument, the most recent path passed to where() is used.
Specifies arguments for an $nor condition.
Specifies arguments for an $or condition.
Make this query throw an error if no documents match the given filter.
This is handy for integrating with async/await, because orFail() saves you
an extra if statement to check if no document was found.
Optional err: NativeError | (() => NativeError)Optional Specifies a $polygon condition
Rest ...coordinatePairs: number[][]Rest Rest ...coordinatePairs: number[][]Rest Specifies paths which should be populated with other documents.
Get/set the current projection (AKA fields). Pass null to remove the current projection.
Optional fields: string | ProjectionFields<DocType>Optional Specifies a $regex query condition. When called with one argument, the most recent path passed to where() is used.
Declare and/or execute this query as a replaceOne() operation. Same as
update(), except MongoDB will replace the existing document and will
not accept any atomic operators ($set, etc.)
Optional filter: FilterQuery<RawDocType>Optional Optional replacement: AnyObject | DocTypeOptional Optional options: mongoose.QueryOptions<DocType>Optional Specifies which document fields to include or exclude (also known as the query "projection")
Sets the MongoDB session associated with this query. Sessions are how you mark a query as part of a transaction.
Adds a $set to this query's update without changing the operation.
This is useful for query middleware so you can add an update regardless
of whether you use updateOne(), updateMany(), findOneAndUpdate(), etc.
Optional value: anyOptional Sets query options. Some options only make sense for certain operations.
Optional overwrite: booleanOptional Sets the query conditions to the provided JSON object.
Specifies an $size query condition. When called with one argument, the most recent path passed to where() is used.
Specifies a $slice projection for an array.
Sets the tailable option (for use with capped collections).
Optional bool: booleanOptional Optional opts: { Optional
Optional numberOptional tailableConverts this query to a customized, reusable query constructor with all arguments and options retained.
Runs a function fn and treats the return value of fn as the new value
for the query to resolve to.
Declare and/or execute this query as an updateMany() operation. Same as
update(), except MongoDB will update all documents that match
filter (as opposed to just the first one) regardless of the value of
the multi option.
Optional filter: FilterQuery<RawDocType>Optional Optional update: UpdateWithAggregationPipeline | UpdateQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Declare and/or execute this query as an updateOne() operation. Same as
update(), except it does not support the multi or overwrite options.
Optional filter: FilterQuery<RawDocType>Optional Optional update: UpdateWithAggregationPipeline | UpdateQuery<RawDocType>Optional Optional options: mongoose.QueryOptions<DocType>Optional Sets the specified number of mongod servers, or tag set of mongod servers,
that must acknowledge this write before this write is considered successful.
Specifies a path for use with chaining.
Optional val: anyOptional If w > 1, the maximum amount of time to
wait for this write to propagate through the replica set before this
operation fails. The default is 0, which means no timeout.
Generated using TypeDoc
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.