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 @@ -153,6 +153,23 @@ After updating, the document has the following values:
153153 ratings: [ { by: 'Customer007', rating: 4 } ]
154154 }
155155
156+ .. important::
157+
158+ The above code uses ``dot notation`` to update the ``make`` field of the
159+ embedded ``details`` document. The code format looks similar to the following
160+ code example, which instead *replaces the entire embedded document*, removing
161+ all other fields in the embedded ``details`` document:
162+
163+ .. code-block:: javascript
164+ :copyable: false
165+
166+ db.products.updateOne(
167+ { _id: 100 },
168+ { $set: { details:
169+ {make: "Kustom Kidz"}
170+ }
171+ })
172+
156173
157174Set Elements in Arrays
158175~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments