Back

Get listdocuments without limit

  • 0
  • Databases
  • Flutter
Mosh Ontong
19 Apr, 2023, 03:44
TypeScript

      final documents = await databases.listDocuments(
          databaseId: AppwriteClientHelper.databaseId,
          collectionId: AppwriteClientHelper.vocabularyCollectionId,
          queries: [
            Query.select([]),
            Query.equal("language", languageSelected.languageId),
            // Query.limit(10),
            Query.orderDesc("\$updatedAt")
          ]);

I have a 39 total documents in my collection. Now, when I fetch all the documents why only it gives me 25 documents? as you can see in my code I already commented out the Query.limit,

TL;DR
The user wants to get a list of documents without any limit. They are currently using a while loop and querying again with an offset when the number of returned documents reaches 100. The user asks if there is a larger limit in the query for Appwrite and shares a link to an article about pagination. The response states that the max limit is 100 and recommends using cursor-based pagination with a limit of 100. The user then asks how they can fetch all the documents without limiting and provides a code snippet. The default limit is explained to be 25. Solution: To fetch all the documents without limiting, the user needs to remove
Drake
19 Apr, 2023, 03:45

The default limit is 25

Mosh Ontong
19 Apr, 2023, 03:46

Then how can I fetch all the list of my documents? without limiting?

Drake
19 Apr, 2023, 03:48
Mosh Ontong
19 Apr, 2023, 03:51

is it okay to set the limit to 1000 Query.limit(1000)

Mosh Ontong
19 Apr, 2023, 03:52

because I am going to create a script to export all documetns

Drake
19 Apr, 2023, 03:55

Max limit is 100

Drake
19 Apr, 2023, 18:02

I really recommend cursor-based pagination with a limit of 100 or so...but, technically, we have removed the max limit, so you can pass a really big number for limit if you really wanted to

Speedy059
3 May, 2023, 18:00

Appwrite now allows a larger limit in the query? I've been doing while loop with a flag called "isMore" and check the return docs (if it reaches 100) and then querying again with offset going up

Speedy059
3 May, 2023, 18:00

How much can you query now?

Drake
3 May, 2023, 18:04

as high as you want...but i recommend sticking with your previous implementation

Speedy059
3 May, 2023, 18:05

Ok

Guille
4 May, 2023, 14:59

Just to complement your answer take a look this article about pagination, the benchmarks are really interesting

https://itnext.io/the-best-database-pagination-technique-is-530abf2aab51

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