Skip to content

Commit f522864

Browse files
TylerBrockSam Kleinman
authored andcommitted
Update db.collection.findAndModify.txt
Signed-off-by: Sam Kleinman <[email protected]>
1 parent b1a7750 commit f522864

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

source/reference/method/db.collection.findAndModify.txt

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ Definition
2525

2626
.. code-block:: none
2727

28-
db.collection.findAndModify( {
29-
query: <document>,
30-
sort: <document>,
31-
remove: <boolean>,
32-
update: <document>,
33-
new: <boolean>,
34-
fields: <document>,
35-
upsert: <boolean>
36-
} );
28+
db.collection.findAndModify({
29+
query: <document>,
30+
sort: <document>,
31+
remove: <boolean>,
32+
update: <document>,
33+
new: <boolean>,
34+
fields: <document>,
35+
upsert: <boolean>
36+
});
3737

3838
The :method:`db.collection.findAndModify()` method takes a document
3939
parameter with the following subdocument fields:
@@ -89,12 +89,12 @@ and multiple clients issue the following command:
8989

9090
.. code-block:: javascript
9191

92-
db.people.findAndModify( {
92+
db.people.findAndModify({
9393
query: { name: "Andy" },
9494
sort: { rating: 1 },
9595
update: { $inc: { score: 1 } },
9696
upsert: true
97-
} )
97+
})
9898

9999
Then, if these clients' :method:`~db.collection.findAndModify()`
100100
methods finish the ``query`` phase before any command starts the
@@ -137,11 +137,11 @@ people collection where the document matches the query criteria:
137137

138138
.. code-block:: javascript
139139

140-
db.people.findAndModify( {
140+
db.people.findAndModify({
141141
query: { name: "Tom", state: "active", rating: { $gt: 10 } },
142142
sort: { rating: 1 },
143143
update: { $inc: { score: 1 } }
144-
} )
144+
})
145145

146146
This method performs the following actions:
147147

@@ -190,12 +190,12 @@ condition:
190190

191191
.. code-block:: javascript
192192

193-
db.people.findAndModify( {
193+
db.people.findAndModify({
194194
query: { name: "Gus", state: "active", rating: 100 },
195195
sort: { rating: 1 },
196196
update: { $inc: { score: 1 } },
197197
upsert: true
198-
} )
198+
})
199199

200200
If the method does **not** find a matching document, the method
201201
performs an upsert. Because the method included the ``sort``
@@ -222,13 +222,13 @@ document matching the ``query`` is not found:
222222

223223
.. code-block:: none
224224

225-
db.people.findAndModify( {
225+
db.people.findAndModify({
226226
query: { name: "Pascal", state: "active", rating: 25 },
227227
sort: { rating: 1 },
228228
update: { $inc: { score: 1 } },
229229
upsert: true,
230230
new: true
231-
} )
231+
})
232232

233233
The method returns the newly inserted document:
234234

0 commit comments

Comments
 (0)