@@ -460,11 +460,11 @@ following form:
460
460
461
461
.. code-block:: javascript
462
462
463
- db.people.findAndModify( {
464
- query: { name: "Tom", state: "active", rating: { $gt: 10 } },
465
- sort: { rating: 1 },
466
- update: { $inc: { score: 1 } }
467
- } );
463
+ db.people.findAndModify( {
464
+ query: { name: "Tom", state: "active", rating: { $gt: 10 } },
465
+ sort: { rating: 1 },
466
+ update: { $inc: { score: 1 } }
467
+ } );
468
468
469
469
However, the :method:`~db.collection.findAndModify()` shell helper
470
470
method returns only the unmodified document, or if ``new`` is
@@ -489,15 +489,15 @@ document or, if no matching document exists, create a new document:
489
489
490
490
.. code-block:: javascript
491
491
492
- db.runCommand(
493
- {
494
- findAndModify: "people",
495
- query: { name: "Gus", state: "active", rating: 100 },
496
- sort: { rating: 1 },
497
- update: { $inc: { score: 1 } },
498
- upsert: true
499
- }
500
- )
492
+ db.runCommand(
493
+ {
494
+ findAndModify: "people",
495
+ query: { name: "Gus", state: "active", rating: 100 },
496
+ sort: { rating: 1 },
497
+ update: { $inc: { score: 1 } },
498
+ upsert: true
499
+ }
500
+ )
501
501
502
502
If the command finds a matching document, the command performs an update.
503
503
0 commit comments