Skip to content

Latest commit

 

History

History
23 lines (13 loc) · 633 Bytes

findOneAndDelete.md

File metadata and controls

23 lines (13 loc) · 633 Bytes

collection.findOneAndDelete

Mongo documentation

Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation.

Arguments

  1. query (String|ObjectId|Object)

  2. [options] (Object|String|Array): If the options is a string, it will be parsed as the fields to select.

  3. [callback] (function)

Returns

A promise.

Example

users.findOneAndDelete({name: 'foo'}).then((doc) => {})