Pagination
All collection find queries are paginated automatically. Responses are returned with top-level meta data related to pagination, and returned documents are nested within a docs array.
Find response properties:
PropertyDescriptiondocsArray of documents in the collectiontotalDocsTotal available documents within the collectionlimitLimit query parameter – defaults to 10totalPagesTotal pages available, based upon the limit queried forpageCurrent page numberpagingCounternumber of the first doc on the current pagehasPrevPagetrue/false if previous page existshasNextPagetrue/false if next page existsprevPagenumber of previous page, null if it doesn’t existnextPagenumber of next page, null if it doesn’t exist
Example response:
1{
2 // Document Array
3 "docs": [
4 {
5 "title": "Page Title",
6 "description": "Some description text",
7 "priority": 1,
8 "createdAt": "2020-10-17T01:19:29.858Z",
9 "updatedAt": "2020-10-17T01:19:29.858Z",
10 "id": "5f8a46a1dd05db75c3c64760"
11 }
12 ],
13 // Metadata
14 "totalDocs": 6,
15 "limit": 1,
16 "totalPages": 6,
17 "page": 1,
18 "pagingCounter": 1,
19 "hasPrevPage": false,
20 "hasNextPage": true,
21 "prevPage": null,
22 "nextPage": 2
23}
Pagination controls
All Payload APIs support the pagination controls below. With them, you can create paginated lists of documents within your application:
ControlDescriptionlimitLimits the number of documents returnedpageGet a specific page number
Disabling pagination within Local API
For find operations within the Local API, you can disable pagination to retrieve all documents from a collection by passing pagination: false to the find local operation.