Skip to content

Commit

Permalink
docs(aggregate): update example to use cursor (#1635)
Browse files Browse the repository at this point in the history
Updates the aggregation tutorial so that the example uses the
cursor instead of just returning it.

Fixes NODE-1236
  • Loading branch information
daprahamian authored Jan 16, 2018
1 parent 212099d commit f2ae38e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/reference/content/tutorials/aggregation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ function simplePipeline(db, callback) {
{ '$unwind': '$categories'},
{ '$group': { '_id': "$categories", 'Bronx restaurants': { '$sum': 1 } } }
],
function(err, results) {
function(err, cursor) {
assert.equal(err, null);

console.log(results)
callback(results);
cursor.toArray(function(err, documents) {
console.log(documents)
callback(documents);
});
}
);
}
Expand Down

0 comments on commit f2ae38e

Please sign in to comment.