File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
source/reference/operator/update Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,23 @@ After updating, the document has the following values:
149149 ratings: [ { by: 'Customer007', rating: 4 } ]
150150 }
151151
152+ .. important::
153+
154+ The above code uses ``dot notation`` to update the ``make`` field of the
155+ embedded ``details`` document. The code format looks similar to the following
156+ code example, which instead *replaces the entire embedded document*, removing
157+ all other fields in the embedded ``details`` document:
158+
159+ .. code-block:: javascript
160+ :copyable: false
161+
162+ db.products.updateOne(
163+ { _id: 100 },
164+ { $set: { details:
165+ {make: "Kustom Kidz"}
166+ }
167+ })
168+
152169
153170Set Elements in Arrays
154171~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments