Hello guys !
Did anyone encounter an issue while using the Local API with pagination and array fields ?
I'm trying to query a paginated list of docs with a disponibilities array field and payload does not return all the docs of each pages.
When the pagination is set to true, payload retrieve only a part of the paginated docs.
Here is the field config :
{
type: "array",
name: "disponibilities",
label: "Disponibilités",
index: true,
fields: [
{
type: "select",
name: "status",
label: "Statut",
required: true,
index: true,
options: [
{
label: "Disponible",
value: "available",
},
{
label: "Réservation en cours",
value: "booking_in_progress",
},
{
label: "Non disponible",
value: "not_available",
},
{
label: "Nous consulter",
value: "consult",
},
],
},
{
type: "date",
name: "start_date",
label: "Date de début",
required: true,
index: true,
},
{
type: "date",
name: "end_date",
label: "Date de fin",
required: true,
index: true,
},
],
}
Here's an exemple of LocalAPI query :
const result = await payload.find({
collection: ITEMS_SLUG,
where: {
"destinations.slug": { contains: "espagne" },
"disponibilities.end_date": { greater_than: new Date() },
"disponibilities.status": { equals: "available" },
},
pagination: true,
page: 1,
limit: 18,
});
Here's the query result:
{
/**
* only some results of the 18 of the page
*/
docs: [{}, {}, {}]
limit: 18,
page: 1,
totalDocs: 140,
totalPages: 8,
...
}