paginate helper as well as the
lower-level skip and limit methods.
paginate()
paginate(page, perPage) returns the requested page of results along with all
the metadata you need to render a paginator. Pages are 1-indexed.
paginate validates its arguments and throws if page or perPage is not a
positive integer.
Manual Pagination with skip and limit
When you need finer control, you can useskip to offset results and limit
to control page size directly:
If you are looping over
skip/limit pages to process a whole collection,
use batch processing with chunk or cursor
instead. Offset loops can skip documents when the loop body modifies them.
