|
4 | 4 | Compound Operations
|
5 | 5 | ===================
|
6 | 6 |
|
7 |
| -.. default-domain:: mongodb |
8 |
| - |
9 | 7 | .. contents:: On this page
|
10 | 8 | :local:
|
11 | 9 | :backlinks: none
|
@@ -75,22 +73,22 @@ the specified query filter and deletes it. The method returns a
|
75 | 73 |
|
76 | 74 | The ``FindOneAndDelete()`` method is an atomic operation, which means it prevents
|
77 | 75 | any other write operations from changing the matching document until it
|
78 |
| - completes. The ``deleteOne()`` method is also an atomic operation, but differs from |
| 76 | + completes. The ``DeleteOne()`` method is also an atomic operation, but differs from |
79 | 77 | ``FindOneAndDelete()`` in that you cannot specify a sort order for the
|
80 | 78 | matched documents.
|
81 | 79 |
|
82 | 80 | To find a document and delete it in separate operations, call the
|
83 |
| - ``findOne()`` method followed by the ``deleteOne()`` method. |
| 81 | + ``FindOne()`` method followed by the ``DeleteOne()`` method. |
84 | 82 |
|
85 | 83 | Modify Behavior
|
86 | 84 | ~~~~~~~~~~~~~~~
|
87 | 85 |
|
88 | 86 | You can modify the behavior of the ``FindOneAndDelete()`` method by
|
89 |
| -passing in a ``FineOneAndDeleteOptions``. If you don't specify a |
90 |
| -``FineOneAndDeleteOptions``, the driver uses the default values for each |
| 87 | +passing in a ``FindOneAndDeleteOptions``. If you don't specify a |
| 88 | +``FindOneAndDeleteOptions``, the driver uses the default values for each |
91 | 89 | option.
|
92 | 90 |
|
93 |
| -The ``FineOneAndDeleteOptions`` type allows you to configure options |
| 91 | +The ``FindOneAndDeleteOptions`` type allows you to configure options |
94 | 92 | with the following methods:
|
95 | 93 |
|
96 | 94 | .. list-table::
|
@@ -164,22 +162,22 @@ document.
|
164 | 162 |
|
165 | 163 | The ``FindOneAndUpdate()`` method is an atomic operation, which means it prevents
|
166 | 164 | any other write operations from changing the matching document until it
|
167 |
| - completes. The ``updateOne()`` method is also an atomic operation, but differs from |
| 165 | + completes. The ``UpdateOne()`` method is also an atomic operation, but differs from |
168 | 166 | ``FindOneAndUpdate()`` in that you cannot specify a sort order for the
|
169 | 167 | matched documents.
|
170 | 168 |
|
171 | 169 | To find a document and update it in separate operations, call
|
172 |
| - the ``findOne()`` method followed by the ``updateOne()`` method. |
| 170 | + the ``FindOne()`` method followed by the ``UpdateOne()`` method. |
173 | 171 |
|
174 | 172 | Modify Behavior
|
175 | 173 | ~~~~~~~~~~~~~~~
|
176 | 174 |
|
177 | 175 | You can modify the behavior of the ``FindOneAndUpdate()`` method by
|
178 |
| -passing in a ``FineOneAndUpdateOptions``. If you don't specify a |
179 |
| -``FineOneAndUpdateOptions``, the driver uses the default values for each |
| 176 | +passing in a ``FindOneAndUpdateOptions``. If you don't specify a |
| 177 | +``FindOneAndUpdateOptions``, the driver uses the default values for each |
180 | 178 | option.
|
181 | 179 |
|
182 |
| -The ``FineOneAndUpdateOptions`` type allows you to configure options |
| 180 | +The ``FindOneAndUpdateOptions`` type allows you to configure options |
183 | 181 | with the following methods:
|
184 | 182 |
|
185 | 183 | .. list-table::
|
@@ -275,17 +273,21 @@ document.
|
275 | 273 | This method differs from the ``ReplaceOne()`` method.
|
276 | 274 | ``FindOneAndReplace()`` performs a find and replace as a single
|
277 | 275 | operation, and eliminates the possibility of someone altering a
|
278 |
| - document between both operations. |
| 276 | + document between both operations. When using ``FindOneAndReplace()``, |
| 277 | + you can also set a sort order on matched documents. |
| 278 | + |
| 279 | + To find a document and replace it in separate operations, call |
| 280 | + the ``FindOne()`` method followed by the ``ReplaceOne()`` method. |
279 | 281 |
|
280 | 282 | Modify Behavior
|
281 | 283 | ~~~~~~~~~~~~~~~
|
282 | 284 |
|
283 | 285 | You can modify the behavior of the ``FindOneAndReplace()`` method by
|
284 |
| -passing in a ``FineOneAndReplaceOptions``. If you don't specify a |
285 |
| -``FineOneAndReplaceOptions``, the driver uses the default values for each |
| 286 | +passing in a ``FindOneAndReplaceOptions``. If you don't specify a |
| 287 | +``FindOneAndReplaceOptions``, the driver uses the default values for each |
286 | 288 | option.
|
287 | 289 |
|
288 |
| -The ``FineOneAndReplaceOptions`` type allows you to configure options |
| 290 | +The ``FindOneAndReplaceOptions`` type allows you to configure options |
289 | 291 | with the following methods:
|
290 | 292 |
|
291 | 293 | .. list-table::
|
|
0 commit comments