After I write a MongoDB aggregate command, I would like to quickly look at the number of results it returned.
Say, my query is something like this: (probably more complex)
db.zipcodes.aggregate( [{ $group :
{ _id : "$state" } }])
Then, right now I do the following to get a total count:
db.zipcodes.aggregate( [{ $group :
{ _id : "$state" }},
{'$group': {_id: null, count: {$sum: 1}}}])
Is there another quicker way to get a count of the results of a MongoDB aggregate query?
PS: I've just seen a related question: MongoDB Aggregation: How to get total records count? . Has there been any progress regarding this?