英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论