Firebase Firestore查询可以';获取文档
所以我在一个名为“Authors”的集合中有一个数组。我想检查是否存在某个字符串(邮件),但它表示getDocuments上的权限被拒绝。 这里有一个小片段:Firebase Firestore查询可以';获取文档,firebase,flutter,dart,google-cloud-firestore,Firebase,Flutter,Dart,Google Cloud Firestore,所以我在一个名为“Authors”的集合中有一个数组。我想检查是否存在某个字符串(邮件),但它表示getDocuments上的权限被拒绝。 这里有一个小片段: List<String> authors; _getAuthors(DocumentSnapshot doc) async { if (await FirebaseAuth.instance.currentUser() != null) { var query = Firestore.instan
List<String> authors;
_getAuthors(DocumentSnapshot doc) async {
if (await FirebaseAuth.instance.currentUser() != null) {
var query = Firestore.instance
.collection('mealList')
.where('Authors', arrayContains: mail);
query.getDocuments().then((value) => print(value));
}
}
Widget buildItem(DocumentSnapshot doc) {
DateTime now = doc.data['Date'].toDate();
DateFormat formatter = DateFormat('dd-MM-yyyy');
String formatted = formatter.format(now);
_getUserId();
_getMail(doc);
if (doc.data['Authors'] != null) {
_getAuthors(doc);
}
检查mealList集合的安全规则。它只是阻止授权用户。请检查mealList集合的安全规则。它只是阻止授权用户。
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /mealList/{uid} {
allow read, write: if request.auth == null;
}
match /shoppingList/{uid} {
allow read, write: if request.auth != null;
}
}
}
match /mealList/{uid} {
allow read, write: if request.auth == null;
}
should be
match /mealList/{uid} {
allow read, write: if request.auth != null;
}