In the following query:
db.orders.aggregate([{ $match : { status: "A"}, { $limit: 5} }]);
How can I get the count of documents after the $match
but before the $limit
is applied?
I still want to return an array of 5 documents. But if I use $group
it seems that it would not preserve the array of documents. Can this be done in one call, or do I have to make two calls?