Rel*_*elm 32 java android firebase google-cloud-firestore
我有以下代码并收到错误:
Invalid collection reference. Collection references must have an odd number of segments
Run Code Online (Sandbox Code Playgroud)
和代码:
private void setAdapter() {
FirebaseFirestore db = FirebaseFirestore.getInstance();
db.collection("app/users/" + uid + "/notifications").get().addOnCompleteListener(task -> {
if (task.isSuccessful()) {
for (DocumentSnapshot document : task.getResult()) {
Log.d("FragmentNotifications", document.getId() + " => " + document.getData());
}
} else {
Log.w("FragmentNotifications", "Error getting notifications.", task.getException());
}
});
}
Run Code Online (Sandbox Code Playgroud)
Die*_*cio 33
然后你需要改变这个:
db.collection("app/users/" + uid + "/notifications")...
Run Code Online (Sandbox Code Playgroud)
为了这:
db.collection("app").document("users").collection(uid).document("notifications")
Run Code Online (Sandbox Code Playgroud)
没关系 ;)
| 归档时间: |
|
| 查看次数: |
24843 次 |
| 最近记录: |