|
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::
|
@@ -160,22 +158,22 @@ document.
|
160 | 158 |
|
161 | 159 | The ``FindOneAndUpdate()`` method is an atomic operation, which means it prevents
|
162 | 160 | any other write operations from changing the matching document until it
|
163 |
| - completes. The ``updateOne()`` method is also an atomic operation, but differs from |
| 161 | + completes. The ``UpdateOne()`` method is also an atomic operation, but differs from |
164 | 162 | ``FindOneAndUpdate()`` in that you cannot specify a sort order for the
|
165 | 163 | matched documents.
|
166 | 164 |
|
167 | 165 | To find a document and update it in separate operations, call
|
168 |
| - the ``findOne()`` method followed by the ``updateOne()`` method. |
| 166 | + the ``FindOne()`` method followed by the ``UpdateOne()`` method. |
169 | 167 |
|
170 | 168 | Modify Behavior
|
171 | 169 | ~~~~~~~~~~~~~~~
|
172 | 170 |
|
173 | 171 | You can modify the behavior of the ``FindOneAndUpdate()`` method by
|
174 |
| -passing in a ``FineOneAndUpdateOptions``. If you don't specify a |
175 |
| -``FineOneAndUpdateOptions``, the driver uses the default values for each |
| 172 | +passing in a ``FindOneAndUpdateOptions``. If you don't specify a |
| 173 | +``FindOneAndUpdateOptions``, the driver uses the default values for each |
176 | 174 | option.
|
177 | 175 |
|
178 |
| -The ``FineOneAndUpdateOptions`` type allows you to configure options |
| 176 | +The ``FindOneAndUpdateOptions`` type allows you to configure options |
179 | 177 | with the following methods:
|
180 | 178 |
|
181 | 179 | .. list-table::
|
@@ -267,17 +265,21 @@ document.
|
267 | 265 | This method differs from the ``ReplaceOne()`` method.
|
268 | 266 | ``FindOneAndReplace()`` performs a find and replace as a single
|
269 | 267 | operation, and eliminates the possibility of someone altering a
|
270 |
| - document between both operations. |
| 268 | + document between both operations. When using ``FindOneAndReplace()``, |
| 269 | + you can also set a sort order on matched documents. |
| 270 | + |
| 271 | + To find a document and replace it in separate operations, call |
| 272 | + the ``FindOne()`` method followed by the ``ReplaceOne()`` method. |
271 | 273 |
|
272 | 274 | Modify Behavior
|
273 | 275 | ~~~~~~~~~~~~~~~
|
274 | 276 |
|
275 | 277 | You can modify the behavior of the ``FindOneAndReplace()`` method by
|
276 |
| -passing in a ``FineOneAndReplaceOptions``. If you don't specify a |
277 |
| -``FineOneAndReplaceOptions``, the driver uses the default values for each |
| 278 | +passing in a ``FindOneAndReplaceOptions``. If you don't specify a |
| 279 | +``FindOneAndReplaceOptions``, the driver uses the default values for each |
278 | 280 | option.
|
279 | 281 |
|
280 |
| -The ``FineOneAndReplaceOptions`` type allows you to configure options |
| 282 | +The ``FindOneAndReplaceOptions`` type allows you to configure options |
281 | 283 | with the following methods:
|
282 | 284 |
|
283 | 285 | .. list-table::
|
|
0 commit comments