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:
| id | name | category | price |
|---|---|---|---|
60119e8a9f1b2c4d8e7f3a21 | Bluetooth Speaker | electronics | 59.00 |
60119e8a9f1b2c4d8e7f3a22 | Smart Bulb | electronics | 14.99 |
60119e8a9f1b2c4d8e7f3a23 | USB-C Hub | electronics | 34.50 |