For Firestore listeners, are security rules checked only on the initial query, or also on subsequent updates received?

huangapple go评论99阅读模式
英文:

For Firestore listeners, are security rules checked only on the initial query, or also on subsequent updates received?

问题

For example, let's say I have a Firestore security rule that uses a get() function, and my initial listener call fetches 100 documents. So that's 101 read operations. Then let's a single document is changed. On receiving the updated document, is the Firestore rule checked again, resulting in 2 reads (the document changed, and the get() function in the rules)?

英文:

For example, let's say I have a Firestore security rule that uses a get() function, and my initial listener call fetches 100 documents. So that's 101 read operations. Then let's a single document is changed. On receiving the updated document, is the Firestore rule checked again, resulting in 2 reads (the document changed, and the get() function in the rules)?

答案1

得分: 1

是的,每当您更新数据库中的依赖文档,都将计为一次文档读取。

而且,无论发生何种更改,客户端 SDK 的每个请求都将首先通过安全规则路由。在更新文档并检索文档时,将导致两次读取。

您还可以参考此文档以获取更多信息,其中包含以下信息,将帮助您了解:

您将为必要用于评估 Cloud Firestore 安全规则的读取而收费。

例如,如果您的规则引用三个文档,但 Cloud Firestore 只需要读取其中两个文档来评估您的规则,那么您将为依赖文档的两次额外读取付费。

英文:

Yes,Any time you update the dependent documents in your DB that will count as a document read.

And Every request from the Client SDK will be first routed through Security Rules no matter what change occurred . On updating the document and retrieving the document resulting in two reads.

You can also refer this document for more information which has following line which will help you
>You are charged for reads that are necessary to evaluate your Cloud Firestore Security Rules.
>
>For example, if your rules refer to three documents, but Cloud Firestore only has to read two of those documents to evaluate your rules, you will be charged for two additional reads for the dependent documents.

huangapple
  • 本文由 发表于 2023年4月11日 14:16:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/75982890.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定