Put list documents in a loop until you don't have any documents left
[SOLVED] Code to clear database
Votes
0
Replies
24
Participants
Unknown
Messages
25
Rank 3: Container
So there isnt any way to surpass the 25 documents limit?
Btw, you don't need to await each delete
Before version 1.3, the maximum limit is 100. After that, you can set some high number, but it's still good to paginate/do it in chunks
Rank 3: Container
Got it, for my frontend im using pagination
Rank 3: Container
Also, how can i change that limit?
The limit query: https://appwrite.io/docs/databases-queries
Rank 3: Container
Got it thanks a lot
[SOLVED] Code to clear database
Moderator
It is specified in docs 🤔
Only on the queries docs for the limit query, right? But if I'm only looking at the list documents API, it's not there and I'd have to dig in a bit before finding out of the default limit.
Before, when we had limit as a param, it was much more apparent. Now, it's kind of hidden away
Moderator
Yes, true
🤣 For DX, it's basically a choice.
For discoverability, force them to provide the limit ever single time does this. Otherwise we'd have to rely on them reading docs.
A possibility is to just add this information in the return object:
{ "total": 25, "limit": 25, "offset": whatever, "other_stuff": wejrk, "documents": [ { "$id": "5e5ea5c16897e", "$collectionId": "5e5ea5c15117e", "$databaseId": "5e5ea5c15117e", "$createdAt": "2020-10-15T06:38:00.000+00:00", "$updatedAt": "2020-10-15T06:38:00.000+00:00", "$permissions": [ "read(\"any\")" ] } ]}But my honest opinion is that long term this is just a quirk they should have to learn 😅 I feel like every framework has a few. We can make it easier with better docs + hinting
The other extreme option is to basically have no limit by default
Docs is fine to me, but it's just a little hidden right now
And be like SQL
where the default behavior is as expected, literally no limit and it just crashes your terminal if you try to select * from BIG_DATA_LAKE
LOL
😅 I feel like we can probably show that we requested up to x objects and y objects were returned
That would offer a hint
The most confusing part is "total"
total of what?
The entire DB?
The entire collection?