Skip to content

Commit 9efb90d

Browse files
authored
DOCSP 24278 - adding insert operations to vehicles example (#1668) (#1679)
* DOCSP-24278 adding insert operation to vehicles example * DOCSP-24278 adding insert operations to vehicles example * DOCSP-24278 adding space
1 parent 2fb2185 commit 9efb90d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

source/reference/operator/aggregation/addFields.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,19 @@ Adding Fields to an Embedded Document
134134
.. _add-field-to-embedded:
135135

136136
Use dot notation to add new fields to embedded documents.
137-
A collection called ``vehicles`` contains the following documents:
137+
138+
For example, create a collection called ``vehicles`` with
139+
the following documents:
138140

139141
.. code-block:: javascript
140142

141-
{ _id: 1, type: "car", specs: { doors: 4, wheels: 4 } }
142-
{ _id: 2, type: "motorcycle", specs: { doors: 0, wheels: 2 } }
143-
{ _id: 3, type: "jet ski" }
143+
db.vehicles.insertMany(
144+
[
145+
{ _id: 1, type: "car", specs: { doors: 4, wheels: 4 } },
146+
{ _id: 2, type: "motorcycle", specs: { doors: 0, wheels: 2 } },
147+
{ _id: 3, type: "jet ski" }
148+
]
149+
)
144150

145151
The following aggregation operation adds a new field ``fuel_type`` to
146152
the embedded document ``specs``.

0 commit comments

Comments
 (0)