FindAll
Exactly the same functionality as findBy, but also receiving paging and limiting and returns an array of the entity and the amount of items returned.
const page = 3;
const limit = 500;
const select = { name: true }
const exampleArray = await this.examplesRepository.findAll(
{
page,
limit,
where: { name: "example" },
["relation-1", "relation-2.nested-relation"] // or { "relation-1": true, "relation-2": { nested-relation: true } }
order: { id: 'ASC' },
select,
},
trx,
);
/** Find all where name = "example"
* Select name only
* Filter where index is between 1000 and 1500
* Load their relations (use . to load nested relations)
* Count the amount of items
* Sorts the result from the lowest value to the highest value
*/
output: { examples: [exampleArray], amount: 500 }
Was this helpful?