I was reading the API documentation (and was experimenting a bit), but it seems that cursor.count()
no longer exists, so I was wondering if it was possible to get a count of your aggregate. This is because I would like to know how many documents there are in total, while still limiting and skipping results. I'm currently using $facet to facilitate this, but unsure if there's a better method.
{
$facet:
{
"results":
[
{
"$skip":
start
},
{
"$limit":
finish
},
],
"total":
[
{
"$count":
"total"
},
]
}
}