@@ -261,14 +261,13 @@ inserting one if it does not exist.
261
261
Starting in v4.7, you can perform an upsert operation by using either of
262
262
the following methods:
263
263
264
- - Use the ``upsert()`` method. When you use this method,
265
- you can perform a **batch upsert** to change or insert multiple documents
266
- in one operation.
264
+ - ``upsert()``: When you use this method, you can perform a **batch
265
+ upsert** to change or insert multiple documents in one operation.
267
266
268
- - Use the ``update()`` method and specify the ``upsert``
269
- option to update all documents that match the query filter or insert
270
- one document if no documents are matched. Only this method is
271
- supported in versions v4.6 and earlier.
267
+ - ``update()``: When you use this method, you must specify the
268
+ ``upsert`` option to update all documents that match the query filter
269
+ or insert one document if no documents are matched. Only this upsert method
270
+ is supported in versions v4.6 and earlier.
272
271
273
272
Upsert Method
274
273
~~~~~~~~~~~~~
@@ -296,8 +295,9 @@ Example
296
295
297
296
This example shows how to use the ``upsert()``
298
297
method to perform an update or insert in a single operation. Click the
299
- :guilabel:`{+code-output-label+}` button to see the resulting data changes if
300
- there is an ``'Angel Olson'`` document in the collection already:
298
+ :guilabel:`{+code-output-label+}` button to see the resulting data changes when
299
+ there is a document in which the value of ``performer`` is ``'Angel
300
+ Olsen'`` in the collection already:
301
301
302
302
.. io-code-block::
303
303
@@ -330,9 +330,9 @@ there is an ``'Angel Olson'`` document in the collection already:
330
330
"updated_at": ...
331
331
}
332
332
333
- In the ``'Angel Olsen'`` document, the ``venue `` field value is not
334
- changed, as the upsert specifies that the update only applies to the
335
- ``ticketsSold`` field.
333
+ In the document in which the value of ``performer `` is ``'Angel
334
+ Olsen'``, the ``venue`` field value is not updated, as the upsert
335
+ specifies that the update applies only to the ``ticketsSold`` field.
336
336
337
337
Update Method
338
338
~~~~~~~~~~~~~
0 commit comments