Skip to content

Commit 0ac74a0

Browse files
jason-price-mongodbjason-price-mongodb
andauthored
DOCSP-12376 findOneAndUpdate change (#6025) (#6028)
Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com> Co-authored-by: jason-price-mongodb <jshfjghsdfgjsdjh@aolsdjfhkjsdhfkjsdf.com>
1 parent f0f0029 commit 0ac74a0

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ Definition
7676
Starting in MongoDB 4.2 (and 4.0.12+, 3.6.14+, and 3.4.23+), the operation
7777
errors if the query argument is not a document.
7878

79+
If no document matches the ``filter``, no document is updated.
7980

80-
8181
* - ``update``
8282

8383
- document or array
@@ -178,21 +178,14 @@ Definition
178178
modify for an update operation on an array field.
179179

180180
.. include:: /includes/extracts/arrayFilters-details.rst
181-
182-
183-
181+
184182
For examples, see :ref:`findOneAndUpdate-arrayFilters`.
185183

186184
.. note::
187185

188186
.. include:: /includes/extracts/arrayFilters-update-aggregation-restriction.rst
189187

190188
.. versionadded:: 3.6
191-
192-
193-
194-
195-
196189

197190
:returns:
198191

@@ -206,7 +199,9 @@ Document Match
206199
~~~~~~~~~~~~~~
207200

208201
:method:`db.collection.findOneAndUpdate()` updates the first matching
209-
document in the collection that matches the ``filter``.
202+
document in the collection that matches the ``filter``. If no document
203+
matches the ``filter``, no document is updated.
204+
210205
The ``sort`` parameter can be used to influence which document is updated.
211206

212207
Projection

0 commit comments

Comments
 (0)