Firestore 安全规则对 get() 文档的读取计数
Firestore Security Rules read count on get() document
我必须检查文档值 != Firebase 安全规则中的字符串值。
所以我必须先检查文档是否存在,然后再检查值。
allow read: !get(path).data || get(path).data.value !== 'xyz';
因为我调用了 get()
方法两次,它会算作 2 次读取吗?如果是,我如何编写逻辑以便一次获取文档数据并重复使用?
根据 documentation,您只需支付一次费用。
You are only charged one read per dependent document even if your rules refer to that document more than once.
我必须检查文档值 != Firebase 安全规则中的字符串值。 所以我必须先检查文档是否存在,然后再检查值。
allow read: !get(path).data || get(path).data.value !== 'xyz';
因为我调用了 get()
方法两次,它会算作 2 次读取吗?如果是,我如何编写逻辑以便一次获取文档数据并重复使用?
根据 documentation,您只需支付一次费用。
You are only charged one read per dependent document even if your rules refer to that document more than once.