@@ -4,37 +4,32 @@ Delete Multiple Documents
44
55.. default-domain:: mongodb
66
7- You can delete several documents in a collection at once with
8- ``collection.deleteMany()``.
9- The ``deleteMany()`` method uses a query document that you provide
10- to match only the subset of the documents in the collection that match
11- the query. If you don't provide a query document (or if you provide an
12- empty document), MongoDB matches all documents in the collection. All
13- matched documents are deleted. While you can use ``deleteMany()`` to
14- delete all documents in a collection, consider using
15- :node-api:`drop() <Collection.html#drop>`
16- instead for better performance and clearer code.
17-
18- You can define additional query options using the ``options``
19- object passed as the second parameter of the ``deleteMany()`` method.
20- You can also pass a
21- :node-api:`callback method
22- <Collection.html#~deleteWriteOpCallback>`
23- as an optional third parameter. For detailed reference documentation,
24- see
25- :node-api:`collection.deleteMany() <Collection.html#deleteMany>`.
26-
27- ``deleteMany()`` behaves in two different ways depending on
28- whether or not a callback method is provided:
29-
30- - if no callback method is provided, ``deleteMany()`` returns a
7+ You can delete several documents in a collection at once using the
8+ :node-api:`collection.deleteMany() <Collection.html#deleteMany>` method.
9+ Pass a query document to the ``deleteMany()`` method to specify a subset
10+ of documents in the collection to delete. If you do not provide a query
11+ document (or if you provide an empty document), MongoDB matches all documents
12+ in the collection and deletes them. While you can use ``deleteMany()``
13+ to delete all documents in a collection, consider using
14+ :node-api:`drop() <Collection.html#drop>` instead for better performance
15+ and clearer code.
16+
17+ You can specify additional options in the ``options`` object passed in
18+ the second parameter of the ``deleteMany()`` method. You can also pass a
19+ :node-api:`callback method <Collection.html#~deleteWriteOpCallback>`
20+ as an optional third parameter. For more detailed information, see
21+ :node-api:`the deleteMany() API documentation <Collection.html#deleteMany>`.
22+
23+ ``deleteMany()`` behaves in two different ways depending on whether you
24+ provide a callback method:
25+
26+ - if you do not specify a callback method, ``deleteMany()`` returns a
3127 :mdn:`Promise <Web/JavaScript/Reference/Global_Objects/Promise>`
32- that resolves to an
33- :mdn:`Object <Web/JavaScript/Reference/Global_Objects/Object>`
28+ that resolves to an object
3429
35- - if a callback method is provided , ``deleteMany()`` returns
36- nothing, and instead passes the result object or error object to the
37- provided callback method
30+ - if you specify a callback method, ``deleteMany()`` returns
31+ nothing, and instead passes the result or error object to the
32+ callback method
3833
3934The
4035:node-api:`result object <Collection.html#~deleteWriteOpResult>`
@@ -50,7 +45,7 @@ Example
5045
5146The following snippet deletes multiple documents from the ``movies``
5247collection. It uses a **query document** that configures the query to
53- match and delete only movies with the title "Santa Claus".
48+ match and delete movies with the title "Santa Claus".
5449
5550.. literalinclude:: /code-snippets/usage-examples/deleteMany.js
5651 :language: javascript
0 commit comments