How to get document count and paginated result in 1 single call

Thanks everyone. I didn’t know this is a common task when doing pagination. $facet and ‘pagination’ are the search keywords.