Hi! I’m trying to get all the records from one collection. What’s your best approach?
Thanks in advance
Hi! I’m trying to get all the records from one collection. What’s your best approach?
Thanks in advance
It’s all in the docs:
Sorry maybe I didn’t explain it well. I mean without limits. Thanks
I have sorted that by creating custom APIs in collection folders. That will help you get the data the way you wanted.
This may not be exactly what you’re looking for, but I changed my api.js in the config folder to increase the maximum pageSize to a very high number (i.e. 1000), which you could also set as the defaultLimit if you wanted.
module.exports = {
rest: {
defaultLimit: 25,
maxLimit: 1000,
withCount: true,
},
};
I think what they mean is they do not want to have to use populate
everywhere and deeply nested and convoluted queries to get things like images and such. If we wanted pieces of data, we’d use GraphQL. I have no idea how to do as I just started and am looking for the answer myself.
Instead of this: GET /api/articles/:id?populate[0]=seoData&populate[1]=seoData.sharedImage&populate[2]=seoData.sharedImage.media
We’d like to do: GET /api/articles/
And just get the entire collection from that request.
Found this: strapi-plugin-populate-deep - npm
Works great and its pretty simple as well if you wanna just clone it and add it directly to your project if you need something custom