Skip to content

Commit e3f3617

Browse files
authored
DOCSP 24278 - adding insert operations to vehicles example (#1668)
* DOCSP-24278 adding insert operation to vehicles example * DOCSP-24278 adding insert operations to vehicles example * DOCSP-24278 adding space
1 parent 7447356 commit e3f3617

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
@@ -132,13 +132,19 @@ Adding Fields to an Embedded Document
132132
.. _add-field-to-embedded:
133133

134134
Use dot notation to add new fields to embedded documents.
135-
A collection called ``vehicles`` contains the following documents:
135+
136+
For example, create a collection called ``vehicles`` with
137+
the following documents:
136138

137139
.. code-block:: javascript
138140

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

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

0 commit comments

Comments
 (0)