I'm currently aggregation data from Mongo using Mongoose, my query looks as follows:
var query = [
  {
    "$match": {
    "searchId": {
        "$in": ["992a27743a6e0916e4f05d9f760065b6"]
      },
      "created_at": {
        "$gte": "2015-08-31T00:00:00.000Z",
        "$lte": "2015-09-02T15:59:59.999Z"
      },
      "language": {
        "$in": ["en"]
      }
    }
  }, {
    "$sort": {
      "created_at": -1
    }
  }, {
    "$skip": 0
  }, {
    "$limit": 10
  }, {
    "$project": {
      "id": "$id",
      "name": "$name",
      "created_at": "$meta.created_at"
    }
  }
]
Now, as you can see, I have a $skip and $limit for pagination in the frontend, but to fully support the frontend, I would need to return the maximum number of documents available.
Is there any way I can do this in the same query?