Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions source/reference/method/db.collection.findOneAndUpdate.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ Definition
Starting in MongoDB 4.2 (and 4.0.12+, 3.6.14+, and 3.4.23+), the operation
errors if the query argument is not a document.

If no document matches the ``filter``, no document is updated.


* - ``update``

- document or array
Expand Down Expand Up @@ -178,21 +178,14 @@ Definition
modify for an update operation on an array field.

.. include:: /includes/extracts/arrayFilters-details.rst




For examples, see :ref:`findOneAndUpdate-arrayFilters`.

.. note::

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

.. versionadded:: 3.6






:returns:

Expand All @@ -206,7 +199,9 @@ Document Match
~~~~~~~~~~~~~~

:method:`db.collection.findOneAndUpdate()` updates the first matching
document in the collection that matches the ``filter``.
document in the collection that matches the ``filter``. If no document
matches the ``filter``, no document is updated.

The ``sort`` parameter can be used to influence which document is updated.

Projection
Expand Down