Skip to content

Commit 7447356

Browse files
authored
DOCSP-24270 adding insert operations to samples examples (#1667)
1 parent 2353b5d commit 7447356

File tree

5 files changed

+48
-25
lines changed

5 files changed

+48
-25
lines changed

source/reference/operator/aggregation/ceil.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,19 @@ Behavior
5252
Example
5353
-------
5454

55-
A collection named ``samples`` contains the following documents:
55+
Create a collection named ``samples`` with the following documents:
5656

5757
.. code-block:: javascript
5858

59-
{ _id: 1, value: 9.25 }
60-
{ _id: 2, value: 8.73 }
61-
{ _id: 3, value: 4.32 }
62-
{ _id: 4, value: -5.34 }
59+
db.samples.insertMany(
60+
[
61+
{ _id: 1, value: 9.25 },
62+
{ _id: 2, value: 8.73 },
63+
{ _id: 3, value: 4.32 },
64+
{ _id: 4, value: -5.34 }
65+
]
66+
)
67+
6368

6469
The following example returns both the original value and the ceiling
6570
value:

source/reference/operator/aggregation/floor.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,18 @@ Behavior
5252
Example
5353
-------
5454

55-
A collection named ``samples`` contains the following documents:
55+
Create a collection named ``samples`` with the following documents:
5656

5757
.. code-block:: javascript
5858

59-
{ _id: 1, value: 9.25 }
60-
{ _id: 2, value: 8.73 }
61-
{ _id: 3, value: 4.32 }
62-
{ _id: 4, value: -5.34 }
59+
db.samples.insertMany(
60+
[
61+
{ _id: 1, value: 9.25 },
62+
{ _id: 2, value: 8.73 },
63+
{ _id: 3, value: 4.32 },
64+
{ _id: 4, value: -5.34 }
65+
]
66+
)
6367

6468
The following example returns both the original value and the floor
6569
value:

source/reference/operator/aggregation/log10.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,18 @@ Behavior
5959
Example
6060
-------
6161

62-
A collection ``samples`` contains the following documents:
62+
Create a collection named ``samples`` with the following documents:
6363

6464
.. code-block:: javascript
6565

66-
{ _id: 1, H3O: 0.0025 }
67-
{ _id: 2, H3O: 0.001 }
68-
{ _id: 3, H3O: 0.02 }
66+
db.samples.insertMany(
67+
[
68+
{ _id: 1, H3O: 0.0025 },
69+
{ _id: 2, H3O: 0.001 },
70+
{ _id: 3, H3O: 0.02 }
71+
]
72+
)
73+
6974

7075
The following example calculates the pH value of the samples:
7176

source/reference/operator/aggregation/round.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,19 @@ the value as an integer.
164164
Example
165165
-------
166166

167-
A collection named ``samples`` contains the following documents:
167+
Create a collection named ``samples`` with the following documents:
168168

169169
.. code-block:: javascript
170170

171-
{ _id: 1, value: 19.25 }
172-
{ _id: 2, value: 28.73 }
173-
{ _id: 3, value: 34.32 }
174-
{ _id: 4, value: -45.39 }
171+
db.samples.insertMany(
172+
[
173+
{ _id: 1, value: 19.25 },
174+
{ _id: 2, value: 28.73 },
175+
{ _id: 3, value: 34.32 },
176+
{ _id: 4, value: -45.39 }
177+
]
178+
)
179+
175180

176181
- The following aggregation returns ``value`` rounded to the
177182
first decimal place:

source/reference/operator/aggregation/trunc.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,18 @@ an integer.
150150
Example
151151
-------
152152

153-
A collection named ``samples`` contains the following documents:
153+
Create a collection named ``samples`` with the following documents:
154154

155155
.. code-block:: javascript
156-
157-
{ _id: 1, value: 19.25 }
158-
{ _id: 2, value: 28.73 }
159-
{ _id: 3, value: 34.32 }
160-
{ _id: 4, value: -45.34 }
156+
157+
db.samples.insertMany(
158+
[
159+
{ _id: 1, value: 19.25 },
160+
{ _id: 2, value: 28.73 },
161+
{ _id: 3, value: 34.32 },
162+
{ _id: 4, value: -45.34 }
163+
]
164+
)
161165

162166
- The following aggregation returns ``value`` truncated to the first
163167
decimal place:

0 commit comments

Comments
 (0)