@@ -25,6 +25,9 @@ db.collection.remove()
25
25
document. The default value is ``false``. Set to ``true`` to
26
26
delete only the first result.
27
27
28
+ .. note::
29
+ .. include:: /includes/fact-remove-capped-collection-restriction.rst
30
+
28
31
.. examples-begin
29
32
30
33
Consider the following examples of the :method:`remove
@@ -54,7 +57,7 @@ db.collection.remove()
54
57
55
58
- To remove the first document that match a deletion criteria, call the
56
59
:method:`remove <db.collection.remove()>` method with the ``query``
57
- criteria and the ``justOne`` parameter set to ``true``:
60
+ criteria and the ``justOne`` parameter set to ``true`` or ``1`` :
58
61
59
62
.. code-block:: javascript
60
63
@@ -64,3 +67,19 @@ db.collection.remove()
64
67
``products`` where ``qty`` is greater than ``20``.
65
68
66
69
.. examples-end
70
+
71
+ .. note::
72
+
73
+ If the ``query`` argument to the :method:`remove()
74
+ <db.collection.remove()>` method matches multiple documents in
75
+ the collection, the delete operation may interleave with other
76
+ write operations to that collection. For an unsharded collection,
77
+ you have the option to override this behavior with the
78
+ :operator:`$atomic` isolation operator, effectively isolating the
79
+ delete operation and blocking all other operations during the
80
+ delete. To isolate the query, include ``$atomic: 1`` in the
81
+ ``query`` parameter as in the following example:
82
+
83
+ .. code-block:: javascript
84
+
85
+ db.products.remove( { qty: { $gt: 20 }, $atomic: 1 } )
0 commit comments