Hi I am trying to get data so that i can use a bar chart to display how many times a document with the same "name" attribute exists. However I have realised that for this to work I need to bypass the Query.limit(100) maximum limit since i may need to query up to 500 documents. Is there a way I can implement this where it will still work well in production? or am i just forced to rewrite everything for MongoDB. this is the code i have: ```const getDefaultData = async () => { const res = await databases.listDocuments(databaseID, 'default_data',[ Query.equal('user', [userID]), Query.orderDesc("name"), Query.limit("100") // the default limit is 25 so i have to use this to get all the data but even 100 is not enough ]);
// this gets the count of the items const nameCounts = res.documents.reduce((acc, obj) => { acc[obj.name] = (acc[obj.name] || 0) + 1; return acc; }, {});
const topDefaultData = Object.entries(nameCounts) .sort((a, b) => b[1] - a[1]) .slice(0, 5) .map(([name, count]) => ({ name, count }));
return topDefaultData; }```
Are you using Appwrite Cloud?
No, im hosting it locally on version 1.2.0
You'll need to paginate to get all the data. In 1.3 we removed the max limit
Ok thanks for the help
[SOLVED] Query more than 100 documents to get data
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...