Skip to content

Commit 5584dac

Browse files
authored
Merge pull request #422 from mcmorisi/DOCSP-47275-update-sort
DOCSP-47275: Add note about UpdateOne sort functionality
2 parents 765ad11 + 2efda42 commit 5584dac

File tree

1 file changed

+7
-0
lines changed
  • source/fundamentals/crud/write-operations

1 file changed

+7
-0
lines changed

source/fundamentals/crud/write-operations/modify.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ Update documents use the following format:
9090
See the MongoDB server manual for a :manual:`complete list of update operators
9191
and descriptions </reference/operator/update-field/>`.
9292

93+
.. tip::
94+
95+
``UpdateOne()`` updates the first document that matches the query filter
96+
you provide. To ensure that you update the correct document, you can use the ``sort``
97+
option to specify the order in which the operation finds documents. To learn more,
98+
see the `UpdateOneOptions <{+api+}/mongo/options#UpdateOneOptions>`__ API documentation.
99+
93100
.. note:: Aggregation Pipelines in Update Operations
94101

95102
If you are using MongoDB Server version 4.2 or later, you can use aggregation

0 commit comments

Comments
 (0)