@@ -18,17 +18,17 @@ Overview
18
18
In this guide, you can learn how to specify **updates** using
19
19
:doc:`builders </fundamentals/builders/>` in the MongoDB Java driver.
20
20
21
- Update builders provide helper methods for the following types of updates:
21
+ The ``Updates`` builder provides helper methods for the following types of updates:
22
22
23
23
- :ref:`Field Updates <field_updates>`
24
24
- :ref:`Array Updates <array_updates>`
25
25
- :ref:`Combining Multiple Update Operators <multiple_updates>`
26
26
27
27
Some methods that expect updates are:
28
28
29
- - updateOne()
30
- - updateMany()
31
- - bulkWrite()
29
+ - `` updateOne()``
30
+ - `` updateMany()``
31
+ - `` bulkWrite()``
32
32
33
33
The ``Updates`` class provides static factory methods for all the MongoDB update
34
34
operators. Each method returns an instance of the :ref:`Bson <bson>`
@@ -212,7 +212,7 @@ The following example renames the ``qty`` field to "quantity":
212
212
:start-after: begin renameUpdate
213
213
:end-before: end renameUpdate
214
214
215
- The example above updates the document to the following state:
215
+ The example above updates the original document to the following state:
216
216
217
217
.. code-block:: json
218
218
:copyable: false
@@ -237,7 +237,7 @@ specified in an update operation.
237
237
:start-after: begin minUpdate
238
238
:end-before: end minUpdate
239
239
240
- The example above updates the document to the following state:
240
+ The example above updates the original document to the following state:
241
241
242
242
.. code-block:: json
243
243
:copyable: false
@@ -265,7 +265,7 @@ maximum of its current value and "8":
265
265
:start-after: begin maxUpdate
266
266
:end-before: end maxUpdate
267
267
268
- The example above updates the document to the following state:
268
+ The example above updates the original document to the following state:
269
269
270
270
.. code-block:: json
271
271
:copyable: false
@@ -280,9 +280,9 @@ The example above updates the document to the following state:
280
280
281
281
Current Date
282
282
~~~~~~~~~~~~
283
- Use the :java-docs:`apidocs/mongodb-driver-core/ currentDate() <com/mongodb/client/model/Updates.html#currentDate(java.lang.String)>`
283
+ Use the :java-docs:`currentDate() <com/mongodb/client/model/Updates.html#currentDate(java.lang.String)>`
284
284
method to assign the value of a field in an update operation to the
285
- current date as a :manual:`date </reference/bson-types/#date>`.
285
+ current date as a :manual:`BSON date </reference/bson-types/#date>`.
286
286
287
287
The following example sets the value of the ``lastModified`` field to
288
288
the current date as a BSON date:
@@ -293,7 +293,7 @@ the current date as a BSON date:
293
293
:start-after: begin currentDateUpdate
294
294
:end-before: end currentDateUpdate
295
295
296
- The example above updates the document to the following state:
296
+ The example above updates the original document to the following state:
297
297
298
298
.. code-block:: json
299
299
:copyable: false
@@ -321,7 +321,7 @@ the current date as a BSON timestamp:
321
321
:start-after: begin currentTimestampUpdate
322
322
:end-before: end currentTimestampUpdate
323
323
324
- The example above updates the document to the following state:
324
+ The example above updates the original document to the following state:
325
325
326
326
.. code-block:: json
327
327
:copyable: false
@@ -339,11 +339,11 @@ Bit
339
339
Use the :java-docs:`bitwiseOr() <apidocs/mongodb-driver-core/com/mongodb/client/model/Updates.html#bitwiseOr(java.lang.String,int)>`,
340
340
:java-docs:`bitwiseAnd() <apidocs/mongodb-driver-core/com/mongodb/client/model/Updates.html#bitwiseAnd(java.lang.String,int)>`,
341
341
and :java-docs:`bitwiseXor() <apidocs/mongodb-driver-core/com/mongodb/client/model/Updates.html#bitwiseXor(java.lang.String,int)>`
342
- methods to perform a bitwise update of the integral value of a field in
342
+ methods to perform a bitwise update of the integer value of a field in
343
343
an update operation.
344
344
345
- The following example performs a bitwise AND between the number
346
- "10" and the integral value of the ``qty`` field:
345
+ The following example performs a bitwise `` AND`` between the number
346
+ "10" and the integer value of the ``qty`` field:
347
347
348
348
.. literalinclude:: /includes/fundamentals/code-snippets/builders/Updates.java
349
349
:language: java
@@ -361,7 +361,7 @@ The bitwise operation results in 15:
361
361
----
362
362
1111
363
363
364
- The example above updates the document to the following state:
364
+ The example above updates the original document to the following state:
365
365
366
366
.. code-block:: json
367
367
:copyable: false
@@ -394,7 +394,7 @@ the ``vendor`` field:
394
394
:start-after: begin addToSetUpdate
395
395
:end-before: end addToSetUpdate
396
396
397
- The example above updates the document to the following state:
397
+ The example above updates the original document to the following state:
398
398
399
399
.. code-block:: json
400
400
:copyable: false
@@ -423,7 +423,7 @@ of the ``vendor`` field:
423
423
:start-after: begin popFirstUpdate
424
424
:end-before: end popFirstUpdate
425
425
426
- The example above updates the document to the following state:
426
+ The example above updates the original document to the following state:
427
427
428
428
.. code-block:: json
429
429
:copyable: false
@@ -450,7 +450,7 @@ The following example removes vendor "A" and "M" from the ``vendor`` array:
450
450
:start-after: begin pullAllUpdate
451
451
:end-before: end pullAllUpdate
452
452
453
- The example above updates the document to the following state:
453
+ The example above updates the original document to the following state:
454
454
455
455
.. code-block:: json
456
456
:copyable: false
@@ -478,7 +478,7 @@ array:
478
478
:start-after: begin pullUpdate
479
479
:end-before: end pullUpdate
480
480
481
- The example above updates the document to the following state:
481
+ The example above updates the original document to the following state:
482
482
483
483
.. code-block:: json
484
484
:copyable: false
@@ -504,7 +504,7 @@ The following examples pushes "C" to the ``vendor`` array:
504
504
:start-after: begin pushUpdate
505
505
:end-before: end pushUpdate
506
506
507
- The example above updates the document to the following state:
507
+ The example above updates the original document to the following state:
508
508
509
509
.. code-block:: json
510
510
:copyable: false
@@ -534,7 +534,7 @@ the ``vendor`` field:
534
534
:start-after: begin combineUpdate
535
535
:end-before: end combineUpdate
536
536
537
- The example above updates the document to the following state:
537
+ The example above updates the original document to the following state:
538
538
539
539
.. code-block:: json
540
540
:copyable: false
0 commit comments