【问题标题】:Firestore Security Rules read count on get() documentFirestore 安全规则读取 get() 文档的计数
【发布时间】:2021-08-27 18:55:17
【问题描述】:

我必须检查文档值!= Firebase 安全规则中的字符串值。 所以我必须先检查文档是否存在,然后检查值。

allow read: !get(path).data || get(path).data.value !== 'xyz';

当我调用 get() 方法两次时,它会计算 2 次读取吗?如果是,我该如何编写逻辑以便我一次获取文档数据并重复使用它?

【问题讨论】:

    标签: firebase google-cloud-firestore firebase-security


    【解决方案1】:

    根据documentation,您只需支付一次费用。

    即使您的规则多次引用该文档,您也只需为每个相关文档支付一次阅读费用。

    【讨论】:

    • 谢谢! @Dharmaraj
    猜你喜欢
    • 1970-01-01
    • 2020-06-19
    • 2019-03-03
    • 2020-08-22
    • 2019-10-15
    • 1970-01-01
    • 1970-01-01
    • 2019-02-01
    • 2021-12-11
    相关资源
    最近更新 更多