Parameters
- [conditions] «Object»
[options.rawResult] «Boolean» if true, returns the
[options.session=null] «ClientSession» The session associated with this query. See transactions docs.
[callback] «Function» optional params are (error, document)
Returns:
- «Query» this
Issues a MongoDB findOneAndDelete command.
This function triggers the following middleware.
findOneAndDelete()
This function differs slightly from Model.findOneAndRemove()
in that findOneAndRemove()
becomes a , as opposed to a command. For most mongoose use cases, this distinction is purely pedantic. You should use findOneAndDelete()
unless you have a good reason not to.
Available options
maxTimeMS
: puts a time limit on the query - requires mongodb >= 2.6.0rawResult
: if true, resolves to the
Callback Signature
Examples
A.where().findOneAndDelete(conditions, options) // return Query
A.where().findOneAndDelete(conditions, callback) // executes
A.where().findOneAndDelete(conditions) // returns Query