Skip to content

Commit a412271

Browse files
committed
DOCSP-52035: Await update operations
1 parent 7baddf7 commit a412271

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/crud/update.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ following:
7373
const query = { name: "Deli Llama" };
7474
const update = { $set: { name: "Deli Llama", address: "3 Nassau St" }};
7575
const options = {};
76-
myColl.updateOne(query, update, options);
76+
const result = await myColl.updateOne(query, update, options);
7777

7878
If a food truck named "Deli Llama" exists, the method call above updates
7979
the document in the collection. However, if there are no food trucks named
@@ -96,7 +96,7 @@ update the document, we can set ``upsert`` to ``true`` in our call to
9696
const query = { name: "Deli Llama" };
9797
const update = { $set: { name: "Deli Llama", address: "3 Nassau St" }};
9898
const options = { upsert: true };
99-
myColl.updateOne(query, update, options);
99+
const result = await myColl.updateOne(query, update, options);
100100

101101
After you run the operation above, your collection looks similar to the
102102
following, even if the ``"Deli Llama"`` document did not exist in your collection

0 commit comments

Comments
 (0)