Paging Results
A very common method of reducing the number of documents returned is paging. Paging involves specifying a number of documents to skip in the matching set as well as a limit on the documents returned. Then the skip value is incremented each time by the amount returned the previous time.
To implement paging on a set of documents, you need to implement the limit and skip options on the options object. The skip option specifies a number of documents to skip before returning documents. By moving the skip value each time you get another set of documents, you can effectively page through the data set. Also, you should always include a sort option when paging data to ensure that the order is always the same. For example, the following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access