Skip to content
Init is coming / May 19 - 23
Back

How to Query more than 25 items from the Appwrite Database

  • 0
  • Databases
  • Web
lordrhodes.
16 May, 2025, 19:32

So I've added this to my query to try and defeat the default 25 item limit:

TypeScript
                        const response = await databases.listDocuments(
                          DATABASE_ID,
                          QUESTION_COLLECTION_ID,
                          [
                            Query.limit(limit),
                            Query.offset(offset)
                          ]
                        );
                        

                        console.log(`📄 Fetched ${response.documents.length} questions (offset ${offset})`);

                      
                        if (response.documents.length === 0) break;
                      
                        allQuestions.push(...response.documents);
                      
                        total = response.total; // Total documents in the collection
                        offset += response.documents.length;
                      
                      } while (offset < total);``` 
Offset is 0 and Limit is 50. 

But I'm still encountering the 25 limit. I've read through the documentation and I've tried implementing different strategies to no avail
TL;DR
To query more than 25 items from the Appwrite Database, developers can utilize a loop structure along with the offset and limit parameters in their query. By fetching data in batches and updating the offset until all data is retrieved, developers can overcome the default limit. In this scenario, the developer has correctly implemented the loop structure, but they may need to ensure that the `limit` parameter is set to their desired limit, in this case, 50.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more