Skip to content

Commit e78a84f

Browse files
committed
DOCS-617 add to delete doc
1 parent aff8cf1 commit e78a84f

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

draft/applications/delete.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,30 @@ Consider the following examples that illustrate the usage of the
7070
.. code-block:: javascript
7171

7272
db.csbios.remove()
73+
74+
.. _crud-delete-remove-isolation:
75+
76+
Capped Collection
77+
~~~~~~~~~~~~~~~~~
78+
79+
.. include:: /includes/fact-remove-capped-collection-restriction.rst
80+
81+
Isolation
82+
~~~~~~~~~
83+
84+
If the ``query`` argument to the :method:`remove()
85+
<db.collection.remove()>` method matches multiple documents in the
86+
collection, the delete operation may interleave with other write
87+
operations to that collection. For an unsharded collection, you have
88+
the option to override this behavior with the :operator:`$atomic`
89+
isolation operator, effectively isolating the delete operation and
90+
blocking all other operations during the delete. To isolate the query,
91+
include ``$atomic: 1`` in the ``query`` parameter as in the following
92+
example:
93+
94+
.. code-block:: javascript
95+
96+
db.csbios.remove( { turing: true, $atomic: 1 } )
97+
98+
7399

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
You cannot apply the :method:`remove() <db.collection.remove()>` method
2+
to a :term:`capped collection`.

source/reference/method/db.collection.remove.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ db.collection.remove()
2525
document. The default value is ``false``. Set to ``true`` to
2626
delete only the first result.
2727

28+
.. note::
29+
.. include:: /includes/fact-remove-capped-collection-restriction.rst
30+
2831
.. examples-begin
2932

3033
Consider the following examples of the :method:`remove
@@ -54,7 +57,7 @@ db.collection.remove()
5457

5558
- To remove the first document that match a deletion criteria, call the
5659
: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``:
5861

5962
.. code-block:: javascript
6063

@@ -64,3 +67,19 @@ db.collection.remove()
6467
``products`` where ``qty`` is greater than ``20``.
6568

6669
.. 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

Comments
 (0)