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:
153
153
ratings: [ { by: 'Customer007', rating: 4 } ]
154
154
}
155
155
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
+
156
173
157
174
Set Elements in Arrays
158
175
~~~~~~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments