Back

[SOLVED] how to get all documents and remove 25 docs limit

  • 1
  • Databases
  • Flutter
  • Cloud
kamal.panara
5 Jan, 2024, 09:37

how to get all documents and remove 25 docs limit using client sdk in flutter.

TL;DR
Title: [SOLVED] Getting all documents and removing the 25 documents limit Solution: In this scenario, using a cloud function or server SDKs is not recommended due to timeout limits. Instead, implement pagination in your front-end app to load fewer documents at a time, improving performance and reducing bandwidth usage. Additionally, consider storing the calculated total amount in a separate location to display as stats on your admin dashboard. If using Appwrite Databases, you can build a loop to fetch the next set of documents until all have been retrieved.
ideclon
5 Jan, 2024, 09:41

Pass, eg, Query.limit(100) to get 100 documents. The max is 5000

kamal.panara
5 Jan, 2024, 09:41

but i don't want any limit

kamal.panara
5 Jan, 2024, 09:41

like firestore allows to get all docs

kamal.panara
5 Jan, 2024, 09:43

can i query all docs in cloud function using server api?

ideclon
5 Jan, 2024, 09:44

Appwrite does not have that option. You could build a loop that’ll continue fetching the next, say 1000 Documents or something until there are no more left to return.

ideclon
5 Jan, 2024, 09:45

My understanding is that Firestore is a very different concept to Appwrite Databases (I’ve never actually used Firebase, so I can’t speak for personal experience, here).

kamal.panara
5 Jan, 2024, 09:45

because i need to query all to calculate the total amount from each doc and save it somewhere so i can show it as stats on admin dashboard of my app.

ideclon
5 Jan, 2024, 09:46

Same limits apply to Server SDKs.

kamal.panara
5 Jan, 2024, 09:47

in front end app i can use pagination for both performace and loading less docs means using less bandwidth unless user requests more docs.

ideclon
5 Jan, 2024, 09:47

I don’t think you’d be able to do that in a Function anyway, even if you could pull more than 5000 records - it would take far to long to do - there’s no way you could do it in within the Function timeout limits.

kamal.panara
5 Jan, 2024, 09:49

then how can handle this kind of requirement? maybe, i can create cloud function which triggers on create, update, delete docs, and adds/subtracts the amount from total amount and updates it?

kamal.panara
5 Jan, 2024, 09:50

[SOLVED] how to get all documents and remove 25 docs limit

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