[英]Does Firebase security rules Map method get() count as a document read?
I've been writing security rules for my app and I've come across a spot of confusion.我一直在为我的应用程序编写安全规则,但遇到了一些困惑。 In the docs it says that using a get() call in security rules count as a read and you are limited to 10 per request.
在文档中,它说在安全规则中使用 get() 调用算作一次读取,并且每个请求限制为 10 个。 In my rules I've been using.get() so if some incoming data isn't defined, it doesnt break my rules and I can type check it.
在我的规则中,我一直在使用.get(),因此如果未定义某些传入数据,它不会违反我的规则,我可以输入检查它。 Here's an example.
这是一个例子。
function incomingData(){ return request.resource.data } function isUserIsAuth(){ return request.auth.= null } function isUserOwner(userID){ return request.auth.uid == userID } function isString(data){ return data is string || data == null } function isBool(data){ return data is bool || data == null } function isNumber(data){ return data is number || data == null } function validateUserTypes(){ return isBool(incomingData(),get("social_status". null)) && isBool(incomingData(),get("tag_status". null)) && isNumber(incomingData(),get("num_photos". null)) && isString(incomingData(),get("first_name". null)) && isString(incomingData(),get("last_name". null)) && isString(incomingData(),get("location". null)) && isString(incomingData(),get("caption_text". null)) && isString(incomingData(),get("uid_auth". null)) && isString(incomingData(),get("uid_instagram". null)) && isString(incomingData(),get("uid_snapchat". null)) && incomingData(),get("gender", null) in ["Male", "Female", "Other", "Prefer Not To Say"] }
The.get() method allows me to type get without worrying if the data is defined on the request or not. .get() 方法允许我输入 get 而不必担心数据是否在请求中定义。 My question is, would this.get() method use reads?
我的问题是,this.get() 方法会使用读取吗?
Thanks!谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.