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
- Increase by operators
I see appwrite have bunch of useful operators for querieng db. One more I would like to suggest is operators like increase the count of a int columns by 1,2.. ...
- createCollection Deprecated
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...