Skip to content

Commit 2fb2185

Browse files
authored
DOCSP-24270 adding insert operations to samples examples (#1667) (#1674)
1 parent fe29393 commit 2fb2185

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
@@ -54,14 +54,19 @@ Behavior
5454
Example
5555
-------
5656

57-
A collection named ``samples`` contains the following documents:
57+
Create a collection named ``samples`` with the following documents:
5858

5959
.. code-block:: javascript
6060

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

6671
The following example returns both the original value and the ceiling
6772
value:

source/reference/operator/aggregation/floor.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,18 @@ Behavior
5454
Example
5555
-------
5656

57-
A collection named ``samples`` contains the following documents:
57+
Create a collection named ``samples`` with the following documents:
5858

5959
.. code-block:: javascript
6060

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

6670
The following example returns both the original value and the floor
6771
value:

source/reference/operator/aggregation/log10.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,18 @@ Behavior
6161
Example
6262
-------
6363

64-
A collection ``samples`` contains the following documents:
64+
Create a collection named ``samples`` with the following documents:
6565

6666
.. code-block:: javascript
6767

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

7277
The following example calculates the pH value of the samples:
7378

source/reference/operator/aggregation/round.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,19 @@ the value as an integer.
195195
Example
196196
-------
197197

198-
A collection named ``samples`` contains the following documents:
198+
Create a collection named ``samples`` with the following documents:
199199

200200
.. code-block:: javascript
201201

202-
{ _id: 1, value: 19.25 }
203-
{ _id: 2, value: 28.73 }
204-
{ _id: 3, value: 34.32 }
205-
{ _id: 4, value: -45.39 }
202+
db.samples.insertMany(
203+
[
204+
{ _id: 1, value: 19.25 },
205+
{ _id: 2, value: 28.73 },
206+
{ _id: 3, value: 34.32 },
207+
{ _id: 4, value: -45.39 }
208+
]
209+
)
210+
206211

207212
- The following aggregation returns ``value`` rounded to the
208213
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)