Returning total for paginated searching

2 posts were split to a new topic: For a big collection of documents, it is faster to execute 2 queries or use aggregations?