Firestore未能获得子收集,而权限拒绝了错误
我想使用Java库获取所有子收集的文档。
我的firestore的数据高于
/groups/group1/posts/post1
/groups/group1/users/user1
我的规则,我设定允许所有测试请求。
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
这是我的Java代码
Iterable<CollectionReference> collections =
db.collection("groups").document("group1").listCollections();
for (CollectionReference collRef : collections) {
System.out.println("Found subcollection with id: " + collRef.getId());
}
,但我遇到此错误
Caused by: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Missing or insufficient permissions.
at io.grpc.Status.asRuntimeException(Status.java:535)
已更新
,这不是Android SDK,官方文档是在这里
,这是我的build.gradel
的一部分
implementation 'com.google.cloud:google-cloud-firestore:3.2.0'
implementation group: 'com.google.cloud', name: 'google-cloud-storage', version: '2.7.1'
I want to get documents with all subcollections using java library.
My firestore has data above
/groups/group1/posts/post1
/groups/group1/users/user1
this is my rule, I set to permit all request for test.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
this is my java code
Iterable<CollectionReference> collections =
db.collection("groups").document("group1").listCollections();
for (CollectionReference collRef : collections) {
System.out.println("Found subcollection with id: " + collRef.getId());
}
but I met this error
Caused by: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Missing or insufficient permissions.
at io.grpc.Status.asRuntimeException(Status.java:535)
updated
this is not android sdk, official document is here
and this is my part of build.gradel
implementation 'com.google.cloud:google-cloud-firestore:3.2.0'
implementation group: 'com.google.cloud', name: 'google-cloud-storage', version: '2.7.1'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我更改了几行以设置凭据,
它使其使工作变得clelaly。
I changed few code lines for setting credential
it make works clealy.