Mongoose Pagination and Filters Mongoose Pagination and Filters mongoose mongoose

Mongoose Pagination and Filters


I'll take the liberty and link to my other answers: ranged pagination and pagination with mongodb and node.js.

Short answer: don't use skip/limit, unless your datasets are small (like < 1000 documents or so). The greater page you fetch, the worse it will perform. Use range queries (field: {$gt: value}), they are much more efficient (if indexed, of course).

And no, you can't return total count and part of the data with one query.