@@ -75,10 +75,10 @@ the following aggregation operation:
7575
7676.. code-block:: javascript
7777
78- db.zipcodes.aggregate({ $group :
79- { _id : "$state",
80- totalPop : { $sum : "$pop" } } },
81- { $match : {totalPop : { $gte : 10*1000*1000 } } } )
78+ db.zipcodes.aggregate( { $group :
79+ { _id : "$state",
80+ totalPop : { $sum : "$pop" } } },
81+ { $match : {totalPop : { $gte : 10*1000*1000 } } } )
8282
8383Aggregations operations using the :method:`aggregate()
8484<db.collection.aggregate()>` helper, process all documents on the
@@ -133,10 +133,10 @@ following aggregation operation:
133133
134134.. code-block:: javascript
135135
136- db.zipcodes.aggregate({ $group :
137- { _id : { state : "$state", city : "$city" },
138- pop : { $sum : "$pop" } } },
139- { $group :
136+ db.zipcodes.aggregate( { $group :
137+ { _id : { state : "$state", city : "$city" },
138+ pop : { $sum : "$pop" } } },
139+ { $group :
140140 { _id : "$_id.state",
141141 avgCityPop : { $avg : "$pop" } } } )
142142
@@ -194,25 +194,25 @@ state, use the following aggregation operation:
194194
195195.. code-block:: javascript
196196
197- db.zipcodes.aggregate({ $group:
198- { _id: { state: "$state", city: "$city" },
199- pop: { $sum: "$pop" } } },
200- { $sort: { pop: 1 } },
201- { $group:
202- { _id : "$_id.state",
203- biggestCity: { $last: "$_id.city" },
204- biggestPop: { $last: "$pop" },
205- smallestCity: { $first: "$_id.city" },
206- smallestPop: { $first: "$pop" } } },
207-
208- // the following $project is optional, and
209- // modifies the output format.
210-
211- { $project:
212- { _id: 0,
213- state: "$_id",
214- biggestCity: { name: "$biggestCity", pop: "$biggestPop" },
215- smallestCity: { name: "$smallestCity", pop: "$smallestPop" } } } )
197+ db.zipcodes.aggregate( { $group:
198+ { _id: { state: "$state", city: "$city" },
199+ pop: { $sum: "$pop" } } },
200+ { $sort: { pop: 1 } },
201+ { $group:
202+ { _id : "$_id.state",
203+ biggestCity: { $last: "$_id.city" },
204+ biggestPop: { $last: "$pop" },
205+ smallestCity: { $first: "$_id.city" },
206+ smallestPop: { $first: "$pop" } } },
207+
208+ // the following $project is optional, and
209+ // modifies the output format.
210+
211+ { $project:
212+ { _id: 0,
213+ state: "$_id",
214+ biggestCity: { name: "$biggestCity", pop: "$biggestPop" },
215+ smallestCity: { name: "$smallestCity", pop: "$smallestPop" } } } )
216216
217217Aggregations operations using the :method:`aggregate()
218218<db.collection.aggregate()>` helper, process all documents on the
0 commit comments