Skip to content

Commit ea08a0b

Browse files
committed
DOCSP-47864: sort order for updateone / replaceone
1 parent e729a2e commit ea08a0b

6 files changed

+32
-8
lines changed

source/reference/method/MongoDBCollection-bulkWrite.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,15 @@ Behavior
142142
.. include:: /includes/extracts/bulkwriteexception-result.rst
143143
.. include:: /includes/extracts/bulkwriteexception-ordered.rst
144144

145-
.. todo: add output and examples
146-
147145
See Also
148146
--------
149147

148+
- :ref:`php-bulk-write`
149+
- :ref:`php-write`
150150
- :phpmethod:`MongoDB\Collection::deleteMany()`
151151
- :phpmethod:`MongoDB\Collection::deleteOne()`
152152
- :phpmethod:`MongoDB\Collection::insertMany()`
153153
- :phpmethod:`MongoDB\Collection::insertOne()`
154154
- :phpmethod:`MongoDB\Collection::replaceOne()`
155155
- :phpmethod:`MongoDB\Collection::updateMany()`
156156
- :phpmethod:`MongoDB\Collection::updateOne()`
157-
- :ref:`php-write`

source/reference/method/MongoDBCollection-replaceOne.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
MongoDB\\Collection::replaceOne()
33
=================================
44

5-
.. default-domain:: mongodb
6-
75
.. contents:: On this page
86
:local:
97
:backlinks: none
@@ -90,6 +88,14 @@ Parameters
9088

9189
.. versionadded:: 1.3
9290

91+
* - sort
92+
- array|object
93+
- The sort specification for the ordering of the matched
94+
documents. Set this option to apply an order to matched
95+
documents before the driver performs the replace operation.
96+
97+
.. versionadded:: 1.21
98+
9399
* - upsert
94100
- boolean
95101
- If set to ``true``, creates a new document when no document matches the

source/reference/method/MongoDBCollection-updateOne.txt

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
MongoDB\\Collection::updateOne()
33
================================
44

5-
.. default-domain:: mongodb
6-
75
.. contents:: On this page
86
:local:
97
:backlinks: none
@@ -95,6 +93,14 @@ Parameters
9593

9694
.. versionadded:: 1.3
9795

96+
* - sort
97+
- array|object
98+
- The sort specification for the ordering of the matched
99+
documents. Set this option to apply an order to matched
100+
documents before the driver performs the update operation.
101+
102+
.. versionadded:: 1.21
103+
98104
* - upsert
99105
- boolean
100106
- If set to ``true``, creates a new document when no document matches the

source/whats-new.txt

+5
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ improvements, and fixes:
6363
- Deprecates the ``flags`` option, used for the deprecated MMAPv1 storage engine.
6464
This option will be removed in {+library-short+} v2.0.
6565

66+
- Adds a sort option to the :phpmethod:`MongoDB\Collection::updateOne()`
67+
and :phpmethod:`MongoDB\Collection::replaceOne()` methods. This
68+
change also allows you to set a sort order as an option when performing
69+
update and replace operations in a bulk operation.
70+
6671
.. _php-lib-version-1.20:
6772

6873
What's New in 1.20

source/write/replace.txt

+4
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ table describes some options you can set in the array:
153153
Server manual.
154154
| Defaults to ``false``.
155155

156+
* - ``sort``
157+
- | Specifies the sort order to apply to documents before
158+
performing the replace operation.
159+
156160
* - ``collation``
157161
- | Specifies the kind of language collation to use when sorting
158162
results. For more information, see :manual:`Collation </reference/collation/#std-label-collation>`

source/write/update.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ describes some options you can set in the array:
119119
Server manual.
120120
| Defaults to ``false``.
121121

122+
* - ``sort``
123+
- | Applies to ``updateOne()`` only. Specifies the sort order to
124+
apply to documents before performing the update operation.
125+
122126
* - ``collation``
123127
- | Specifies the kind of language collation to use when sorting
124128
results. For more information, see :manual:`Collation </reference/collation/#std-label-collation>`
@@ -226,4 +230,4 @@ guide, see the following API documentation:
226230

227231
- :phpmethod:`MongoDB\Collection::updateOne()`
228232
- :phpmethod:`MongoDB\Collection::updateMany()`
229-
- :phpclass:`MongoDB\UpdateResult`
233+
- :phpclass:`MongoDB\UpdateResult`

0 commit comments

Comments
 (0)