Skip to content

Commit 2c7e1d8

Browse files
DOCSP-24272 Add insert command to computed data example (#7297) (#7356)
* DOCSP-24272 add insert command * DOCSP-24272 add insert command * DOCSP-24272 add insert command * DOCSP-24272 add insert command
1 parent 9dd2f01 commit 2c7e1d8

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

source/tutorial/model-computed-data.txt

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,30 +48,30 @@ An application displays movie viewer and revenue information.
4848
Consider the following ``screenings`` collection:
4949

5050
.. code-block:: javascript
51-
52-
// screenings collection
53-
54-
{
55-
"theater": "Alger Cinema",
56-
"location": "Lakeview, OR",
57-
"movie_title": "Reservoir Dogs",
58-
"num_viewers": 344,
59-
"revenue": 3440
60-
}
61-
{
62-
"theater": "City Cinema",
63-
"location": "New York, NY",
64-
"movie_title": "Reservoir Dogs",
65-
"num_viewers": 1496,
66-
"revenue": 22440
67-
}
68-
{
69-
"theater": "Overland Park Cinema",
70-
"location": "Boise, ID",
71-
"movie_title": "Reservoir Dogs",
72-
"num_viewers": 760,
73-
"revenue": 7600
74-
}
51+
52+
db.screenings.insertMany( [
53+
{
54+
theater : "Alger Cinema",
55+
location : "Lakeview, OR",
56+
movie_title : "Reservoir Dogs",
57+
num_viewers : 344,
58+
revenue : 3440
59+
},
60+
{
61+
theater : "City Cinema",
62+
location : "New York, NY",
63+
movie_title : "Reservoir Dogs",
64+
num_viewers : 1496,
65+
revenue : 22440
66+
},
67+
{
68+
theater : "Overland Park Cinema",
69+
location : "Boise, ID",
70+
movie_title : "Reservoir Dogs",
71+
num_viewers : 760,
72+
revenue : 7600
73+
}
74+
] )
7575

7676
Users often want to know how many people saw a certain movie and how
7777
much money that movie made. In this example, to total ``num_viewers``
@@ -82,16 +82,17 @@ is requested, you can compute the total values and store them in a
8282
``movies`` collection with the movie record itself:
8383

8484
.. code-block:: javascript
85-
:emphasize-lines: 5-6
86-
87-
// movies collection
88-
89-
{
90-
"title": "Reservoir Dogs",
91-
"total_viewers": 2600,
92-
"total_revenue": 33480,
93-
...
94-
}
85+
:copyable: false
86+
:emphasize-lines: 4-5
87+
88+
db.movies.insertOne( [
89+
{
90+
title : "Reservoir Dogs",
91+
total_viewers : 2600,
92+
total_revenue : 33480,
93+
...
94+
}
95+
] )
9596

9697
In a low write environment, the computation could be done in
9798
conjunction with any update of the ``screenings`` data.

0 commit comments

Comments
 (0)