1

Consider the following maximum array size: Array

Now let's say a user performs a push() childByAutoId. What I expect to happen is

if (arraySize > arraySizeLimit) {
// Delete first Index
}

I am fairly new to firebase security rules. I did some reading but still struggling with this. I apologise for not having any "attempt" code to present.

Joakim Danielson
  • 43,251
  • 5
  • 22
  • 52

1 Answers1

3

There's no way for security rules to check the size of a list like that.

Th main options that I know of, are:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Hi Puf, would your firebase bill be lower if you chose to implement this yourself rather than use the extension you suggested? (other than the 0.02$/month). I can imagine if I were to implement this, I would need to use database transactions which costs. How is the balance like? – Medo Almouhtadi Aug 10 '21 at 12:40
  • 1
    There is no cost for using an Extension beyond the cost of the underlying services it uses. So if you'd implement it the same way yourself, the cost would be the same. But if you want to implement it with only client-side code and server-side security rules, that's an option too. Whether that is cheaper is hard to say, but it will prevent your project having to be on the paid plan. – Frank van Puffelen Aug 10 '21 at 14:43
  • 1
    Note that the mini-charges coming from Cloud Functions artifacts in your Storage buckets should no longer appear if you use a recent CLI to deploy your Functions, as they automatically clean up the temporary container files. See https://www.youtube.com/watch?v=aHaI0jZ5rwM&list=PLl-K7zZEsYLm9G2M1W5ztrDvMv-CiFzLM&index=1&t=1s – Frank van Puffelen Aug 10 '21 at 14:45