You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/fundamentals/crud/write-operations/change-a-document.txt
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ current inventory:
40
40
Update
41
41
------
42
42
43
-
Update operations can change the fields and values. They apply changes
43
+
Update operations can change fields and values. They apply changes
44
44
specified in an update document to one or more documents that match your
45
45
query filter.
46
46
@@ -61,6 +61,9 @@ You can call the ``updateOne()`` and ``updateMany()`` methods on a
61
61
Update Operation Parameters
62
62
~~~~~~~~~~~~~~~~~~~~~~~~~~~
63
63
64
+
The ``updateOne()`` and ``updateMany()`` methods both have the following
65
+
parameters:
66
+
64
67
- ``query`` specifies a query filter with the criteria to match documents to update in your collection
65
68
- ``updateDocument`` specifies the fields and values to change in the matching document or documents. For this example, we use the :doc:`Updates builder </fundamentals/builders/updates>` to create the update document.
66
69
@@ -146,6 +149,8 @@ instance as follows:
146
149
Replace Operation Parameters
147
150
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
148
151
152
+
The ``replaceOne()`` method has the following parameters:
153
+
149
154
- ``query`` specifies a query filter with the criteria to match a document to replace in your collection
150
155
- ``replacementDocument`` specifies fields and values of a new ``Document`` object to replace in the matched document
151
156
@@ -158,8 +163,8 @@ thought was 20 cans of pink paint is actually 25 cans of orange paint.
158
163
To update the inventory, call the ``replaceOne()`` method specifying the
159
164
following:
160
165
161
-
- A query filter that matches the ``color`` is "pink"
162
-
- A replacement document that contains: ``color`` is "orange" and ``qty`` is "25"
166
+
- A query filter that matches documents where the ``color`` is "pink"
167
+
- A replacement document where the ``color`` is "orange" and the ``qty`` is "25"
0 commit comments