Skip to content

docs(db-mongodb): document Local API default limit & unlimited usage (closes #13417) #13471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/local-api/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,31 @@ const result = await payload.find({
showHiddenFields: true,
})
```
### Pagination & limits

By default, Local API `find` uses the collection’s pagination settings. If no `limit` is provided, the per-page default comes from your Collection’s `pagination.defaultLimit` (defaults to **10**). See [Collection Config → pagination](../configuration/collections).

To return **all** matched documents (disable pagination), either:

- pass `limit: 0` (disables pagination), or
- set `pagination: false`.

```ts
// Use the collection default (pagination.defaultLimit, defaults to 10)
const page = await payload.find({
collection: 'posts',
})

// Return all matched documents (no pagination)
const all = await payload.find({
collection: 'posts',
limit: 0, // disables pagination
// or: pagination: false
})

```
> See also: [Pagination](/docs/queries/pagination) and [Querying your Documents](/docs/queries/overview).


### Find by ID#collection-find-by-id

Expand Down