Back

[SOLVED] List all documents without limit, as my data is too big.

  • 0
  • Self Hosted
  • Databases
  • Web
hopeless_
8 Jun, 2023, 08:36

$result = $databases->listDocuments($databaseId, $collectionId); $data = json_encode($result); here i want to all those documents, as data will too big and anonymous amount(1k or 10k...),is there query to achieve this?

TL;DR
There is no direct way to query for an unlimited number of documents. You can use pagination or set a limit value, and if you don't know how much data there is, you can first call listDocuments with limit(0) to get the total document count and then call it again with the calculated total. If you are using PHP, you can check the documentation on Queries.limit for more information. Here is an example code snippet: $params = [ 'limit' => 5000, ]; $result = $databases->listDocuments($databaseId, $collectionId, $params); $data = json_encode($result);
Bouahaza
8 Jun, 2023, 10:54

Check Queries.limit on doc

hopeless_
8 Jun, 2023, 11:18

thanks,but i didn't find any doc about query in PHP

hopeless_
8 Jun, 2023, 11:21

yes,i was following this doc, but how to attach query with them?$params = [ 'limit' => 5000, ]; $result = $databases->listDocuments($databaseId, $collectionId, $params); $data = json_encode($result); (is this the right way to do this?)

Bouahaza
8 Jun, 2023, 11:22
hopeless_
8 Jun, 2023, 11:30

i really appreciate your help,but what if i don't want to use any limit..bcz you we will never know how much data is there?so should i leave limit value empty?

Bouahaza
8 Jun, 2023, 11:32

For what I know, you can't query "unlimited" documents. If you want to query all, you can call listDocument once, with limit(0), it'll give you total document, and call again listDocument with limit = total

Bouahaza
8 Jun, 2023, 11:33

If I remember, max limit is 5000

Bouahaza
8 Jun, 2023, 11:33

Or you can paginate, ofc

hopeless_
10 Jun, 2023, 06:41

[Solved]List all documents without limit, as my data is too big.

Drake
10 Jun, 2023, 15:41

[SOLVED] List all documents without limit, as my data is too big.

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