0

In my app, each user has a document in the users collection of my database. Under each user's document, there is a subcollection for that user's uploaded foods. By default, I want to limit it so that the user cannot add more than 25 foods to their personal subcollection. Is there a way to check via Security Rules if the collection size is <= 25?

Doug Stevenson
  • 268,359
  • 30
  • 341
  • 380
DangItsPang
  • 19
  • 1
  • 2

1 Answers1

0

It's not possible in security rules. It's not even possible with a regular client query.

If you want a document count, you will have to manage one of your own in a single document. Then you could write rules to check against the count that you manage in that document.

Doug Stevenson
  • 268,359
  • 30
  • 341
  • 380