Skip to content

DOCSP-12376 findOneAndUpdate change (#6025) #6027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2021
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 @@ -75,8 +75,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 @@ -176,21 +176,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 @@ -204,7 +197,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