[英]Angular Firestore security rules
I'm trying to query a collection of city names which has the city's name as the document ID, and a single field in the document called "count" which is incremented by a cloud function.我正在尝试查询以城市名称作为文档 ID 的城市名称集合,以及文档中名为“count”的单个字段,该字段由云 function 递增。
However when I try to query this data, I'm told insufficient permissions by Firebase.但是,当我尝试查询这些数据时,Firebase 告诉我权限不足。
Here's the code that queries Firestore这是查询 Firestore 的代码
db = firebase.firestore()
async getCities() {
var docRef = await this.db.collection("Cities").orderBy("count", "desc").limit(10)
.get()
.then(function(querySnapshot){
querySnapshot.forEach(function(doc) {
console.log(doc.id, " => ", doc.data());
})
})
.catch(function(error) {
console.log("Error getting documents: ", error);
});
I'm a bit confused because the rules playground indicates this query should be allowed.我有点困惑,因为规则游乐场表明应该允许此查询。
Here's the section of my rules that the playground says is allowing my read这是操场上说允许我阅读的规则部分
match /Cities/{docId} {
allow get;
}
Or is it because I'm trying to read a subset of the collection?还是因为我正在尝试读取集合的子集?
You need to change the security rules from false to true,that's what happend to me when I wanted to post data to the Firestore database您需要将安全规则从 false 更改为 true,这就是我想将数据发布到 Firestore 数据库时发生的事情
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.