繁体   English   中英

Firestore 安全规则和读取限制

[英]Firestore Security Rules and Read Limits

以以下安全规则为例:

service cloud.firestore {
  match /databases/{database}/documents {
    // Allow the user to read data if the document has the 'visibility'
    // field set to 'public'
    match /cities/{city} {
      allow read: if resource.data.visibility == 'public';
    }
  }
}

如果资源的条件为 false,则读取此集合中文档(例如cities/SF )的请求是否会计入 Firestore 帐户的读取限制?

例如,假设cities/SF的 resource.data.visibility 属性设置为“private”,并且对文档进行了读取请求。 这个读取请求可以无限次发出,而不会产生帐户费用吗? 还是对规则本身的评估算作一次阅读?

每当您在规则中使用resource时,它最多会花费一次读取,并且会计入使用配额。

请参阅以下位置的文档:

资源变量https://firebase.google.com/docs/rules/rules-language

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM