Bando Documentation
findMany()
Query documents and receive the results together with the total count.
Querying content
After creating documents, the next task is retrieving them in your application.
Bando lets you combine filters, pagination, and sorting in a single query.
A real example
Imagine we want the 10 most recently published posts:
What do we receive?
The result contains two important pieces of information:
data contains the documents found.
total contains the total number of documents matching the query, allowing you to build pagination into the interface.
Pagination
limit defines how many documents we want to receive.offset defines how many documents should be skipped before results start being returned.
For example, to fetch the first 10:
To fetch the next 10:
Sorting
Sorting accepts id, createdAt, andupdatedAt.
A - before the field means descending order:
Filters
Current filters use equality.
This searches for documents whose published field is true.
| Parâmetro | Tipo | Obrigatório | Por omissão | Descrição |
|---|---|---|---|---|
limit | integer | não | — | Maximum number of documents returned. Must be a non-negative integer. |
offset | integer | não | 0 | Number of documents skipped before results start being returned. |
sort | string | não | -createdAt | Field used to sort results. Accepts id, createdAt, or updatedAt. The - prefix indicates descending order. |
field | string | não | — | Equality filter. For example, published=true searches for documents whose published field is true. |
Learn about the TypeScript client →