Back

[Solved] Delete document are limited to 25 docs?

  • 1
  • Self Hosted
  • Databases
Binho.dev πŸ’™
29 May, 2023, 20:48

I'm trying to delete documents in bulk, but it's limited to 25 documents, why? In the documentation it says that the request is up to 60 deletions per minute.

I can do mass document creation and update normally, but not deletion.

TL;DR
The user was having trouble deleting documents in bulk and noticed that there was a limit of 25 documents. They created a function to handle mass deletion and used Query.limit() to solve the problem. Another user recommended against disabling/extending rate limiting. The issue has been solved by implementing the solution with Query.limit(). The limitation of 25 documents was due to rate limiting, which is in place to prevent abuse and ensure security. The user can now delete documents in bulk successfully.
D5
29 May, 2023, 20:59

Rate limiting

D5
29 May, 2023, 20:59

Why?

D5
29 May, 2023, 20:59

Preventing anyone abusing your app

Binho.dev πŸ’™
30 May, 2023, 01:16

In docs:

Rate Limits This endpoint is limited to 60 requests in every 1 minutes per IP address, method and user account. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

Binho.dev πŸ’™
30 May, 2023, 01:35

I found the solution. And reading the source code, I saw that there is a limit to list the documents, I could change the source code or make a Query.limit().

Binho.dev πŸ’™
30 May, 2023, 01:36

@D5 Thank you for your patience.

Binho.dev πŸ’™
30 May, 2023, 01:37

[Solved] Delete document are limited to 25 docs?

D5
30 May, 2023, 08:03

@Binho.dev πŸ’™ I don't recommend such approach, that's basically disabling/extending rate limiting

D5
30 May, 2023, 08:03

I think the best solution is making a function to delete the documents

Binho.dev πŸ’™
30 May, 2023, 09:43

@D5 So, I created a function for this, in fact I had already created it, but I was limiting up to 25 documents, but with Query.limit() I solved the problem.

D5
30 May, 2023, 09:44

You need to setup API key in the function. With that, you should not have any problem. Don't confuse coding functions client-sided with appwrite functions

Binho.dev πŸ’™
30 May, 2023, 11:07

I created a API Rest, it connects with Appwrite, but I needed a route that could make the mass deletion of documents at special times, I’m doing this on the server side.

Binho.dev πŸ’™
30 May, 2023, 13:41

@D5 Working fine!

TypeScript
[1] Requisição recebida: [POST] β€’ /roads-delete-database β€’ 30/5/2023-10:38:36
[1] Documento deletado/removido com sucesso. 0
[1] Documento deletado/removido com sucesso. 1
[1] Documento deletado/removido com sucesso. 2
[1] Documento deletado/removido com sucesso. 3
...
[1] Documento deletado/removido com sucesso. 56
[1] Documento deletado/removido com sucesso. 57
D5
30 May, 2023, 14:31

So you made it gradually?

Binho.dev πŸ’™
30 May, 2023, 15:29

Mass deletion does not always occur, but once a month. Now the way I’m deleting yes, it’s deleting one file at a time. I list the amount of files in a collection and then consequently they are deleted.

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