Docs Menu

Docs HomeDevelop ApplicationsMongoDB Manual

Bulk.find.remove()

On this page

  • Description
  • Example

Tip

Bulk.find.remove()

Adds a remove operation to a bulk operations list. Use the Bulk.find() method to specify the condition that determines which documents to remove. The Bulk.find.remove() method removes all matching documents in the collection. To limit the remove to a single document, see Bulk.find.removeOne().

The following example initializes a Bulk() operations builder for the items collection and adds a remove operation to the list of operations. The remove operation removes all documents in the collection where the status equals "D":

var bulk = db.items.initializeUnorderedBulkOp();
bulk.find( { status: "D" } ).remove();
bulk.execute();

Tip

See also:

←  Bulk.find.hint()Bulk.find.removeOne() →

On this page