Home > front end >  Firestore Transaction security rules: caching and limits
Firestore Transaction security rules: caching and limits

Time:01-05

Imagine you execute a Firestore transaction on the client in which you create three documents: a, b, and c.

In the security rules, you do the following for:

  • a: check if b and c exists with getAfter
  • b: check if a and c exists with getAfter
  • c: check if a and b exists with getAfter

So my question is whether this will result in 6 reads counting towards the limit or whether Firestore caches all reads and will only perform three (or even zero?) reads.

Thanks for your help!

CodePudding user response:

When a document is read during the evaluation of a rule, reading the same document second time during the evaluation of that same rule will use the previously read data. It will not incur an additional read.

  •  Tags:  
  • Related