@@ -29,9 +29,9 @@ and operators, see the
29
29
[ manual:] ( https://docs.mongodb.com/manual/core/aggregation-pipeline/ )
30
30
31
31
The following example uses the aggregation pipeline on the
32
- `` restaurants `` sample dataset to find
33
- a list of the total number of 5-star restaurants, grouped by restaurant
34
- category.
32
+ [ restaurant ] ( https://docs.mongodb.org/getting-started/node/import-data/ )
33
+ sample dataset to find a list of restaurants located in the Bronx,
34
+ grouped by restaurant category.
35
35
36
36
``` js
37
37
var MongoClient = require (' mongodb' ).MongoClient
@@ -48,9 +48,9 @@ MongoClient.connect(url, function(err, db) {
48
48
var simplePipeline = function (db , callback ) {
49
49
var collection = db .collection ( ' restaurants' );
50
50
collection .aggregate (
51
- [ { ' $match' : { " stars " : 5 } },
51
+ [ { ' $match' : { " borough " : " Bronx " } },
52
52
{ ' $unwind' : ' $categories' },
53
- { ' $group' : { ' _id' : " $categories" , ' fiveStars ' : { ' $sum' : 1 } } }
53
+ { ' $group' : { ' _id' : " $categories" , ' Bronx restaurants ' : { ' $sum' : 1 } } }
54
54
],
55
55
function (err , results ) {
56
56
assert .equal (err, null );
@@ -179,5 +179,3 @@ var simpleDistinct = function(db, callback) {
179
179
);
180
180
}
181
181
```
182
-
183
-
0 commit comments