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) => {})

results matching ""

    No results matching ""