Back

How to limit the number of documents a user can create in a collection?

  • 0
  • Databases
  • Accounts
  • General
  • Users
  • REST API
shera_x
3 Feb, 2024, 18:57

I have addresses collection and a user can have multiple addresses. I want to set a limit of 20 addresses per user. This is also a potential security risk as one account may create as many records in the collection as allowed by the rate limit and thus potentially infinitely increasing the collection size.

TL;DR
Solution: To limit the number of documents a developer can create in a collection, you can use an Appwrite Function. In this case, the developer wants to set a limit of 20 addresses per user. This can be achieved by implementing rate limits and enforcing a maximum number of documents per user. By doing this, you can ensure that an account cannot create an unlimited number of records and potentially increase the collection size indefinitely. Keep in mind that rate limits should be configured appropriately to prevent abuse.
Steven
3 Feb, 2024, 18:58

Just like any other validation, you'd use an Appwrite Function

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