|
4 | 4 | Compound Operations
|
5 | 5 | ===================
|
6 | 6 |
|
7 |
| -.. default-domain:: mongodb |
| 7 | +.. meta:: |
| 8 | + :description: Learn how to perform compound operations in MongoDB using Go, combining read and write actions into a single atomic operation to prevent data alteration. |
8 | 9 |
|
9 | 10 | .. contents:: On this page
|
10 | 11 | :local:
|
@@ -75,22 +76,22 @@ the specified query filter and deletes it. The method returns a
|
75 | 76 |
|
76 | 77 | The ``FindOneAndDelete()`` method is an atomic operation, which means it prevents
|
77 | 78 | any other write operations from changing the matching document until it
|
78 |
| - completes. The ``deleteOne()`` method is also an atomic operation, but differs from |
| 79 | + completes. The ``DeleteOne()`` method is also an atomic operation, but differs from |
79 | 80 | ``FindOneAndDelete()`` in that you cannot specify a sort order for the
|
80 | 81 | matched documents.
|
81 | 82 |
|
82 | 83 | To find a document and delete it in separate operations, call the
|
83 |
| - ``findOne()`` method followed by the ``deleteOne()`` method. |
| 84 | + ``FindOne()`` method followed by the ``DeleteOne()`` method. |
84 | 85 |
|
85 | 86 | Modify Behavior
|
86 | 87 | ~~~~~~~~~~~~~~~
|
87 | 88 |
|
88 | 89 | 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 |
| 90 | +passing in a ``FindOneAndDeleteOptions``. If you don't specify a |
| 91 | +``FindOneAndDeleteOptions``, the driver uses the default values for each |
91 | 92 | option.
|
92 | 93 |
|
93 |
| -The ``FineOneAndDeleteOptions`` type allows you to configure options |
| 94 | +The ``FindOneAndDeleteOptions`` type allows you to configure options |
94 | 95 | with the following methods:
|
95 | 96 |
|
96 | 97 | .. list-table::
|
@@ -160,22 +161,22 @@ document.
|
160 | 161 |
|
161 | 162 | The ``FindOneAndUpdate()`` method is an atomic operation, which means it prevents
|
162 | 163 | any other write operations from changing the matching document until it
|
163 |
| - completes. The ``updateOne()`` method is also an atomic operation, but differs from |
164 |
| - ``FindOneAndUpdate()`` in that you cannot specify a sort order for the |
165 |
| - matched documents. |
| 164 | + completes. The ``UpdateOne()`` method is also an atomic operation, but differs from |
| 165 | + ``FindOneAndUpdate()`` because you cannot return the pre-image of the |
| 166 | + updated document when using ``UpdateOne()``. |
166 | 167 |
|
167 | 168 | To find a document and update it in separate operations, call
|
168 |
| - the ``findOne()`` method followed by the ``updateOne()`` method. |
| 169 | + the ``FindOne()`` method followed by the ``UpdateOne()`` method. |
169 | 170 |
|
170 | 171 | Modify Behavior
|
171 | 172 | ~~~~~~~~~~~~~~~
|
172 | 173 |
|
173 | 174 | 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 |
| 175 | +passing in a ``FindOneAndUpdateOptions``. If you don't specify a |
| 176 | +``FindOneAndUpdateOptions``, the driver uses the default values for each |
176 | 177 | option.
|
177 | 178 |
|
178 |
| -The ``FineOneAndUpdateOptions`` type allows you to configure options |
| 179 | +The ``FindOneAndUpdateOptions`` type allows you to configure options |
179 | 180 | with the following methods:
|
180 | 181 |
|
181 | 182 | .. list-table::
|
@@ -273,11 +274,11 @@ Modify Behavior
|
273 | 274 | ~~~~~~~~~~~~~~~
|
274 | 275 |
|
275 | 276 | 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 |
| 277 | +passing in a ``FindOneAndReplaceOptions``. If you don't specify a |
| 278 | +``FindOneAndReplaceOptions``, the driver uses the default values for each |
278 | 279 | option.
|
279 | 280 |
|
280 |
| -The ``FineOneAndReplaceOptions`` type allows you to configure options |
| 281 | +The ``FindOneAndReplaceOptions`` type allows you to configure options |
281 | 282 | with the following methods:
|
282 | 283 |
|
283 | 284 | .. list-table::
|
|
0 commit comments