任何人都可以在Firestore中对这种结构发表意见吗?
我想显示当前登录用户的数据。 让我们说我的应用中有一些用户:
我希望查询类似于firebaseFirestore.collection(" Complaints")。document(user_id).addSnapshotListener(new EventListener()
这是我的代码:
firebaseFirestore.collection(" Complaints")。addSnapshotListener(new EventListener(){ @覆盖 public void onEvent(QuerySnapshot documentSnapshots,FirebaseFirestoreException e){
for (DocumentChange doc: documentSnapshots.getDocumentChanges())
{
if (doc.getType() == DocumentChange.Type.ADDED)
{
Complaints complaints = doc.getDocument().toObject(Complaints.class);
complaintsList.add(complaints);
complaintsRecyclerAdapter.notifyDataSetChanged();
}
}
}
});
答案 0 :(得分:1)
通常这是一个很好的结构
this.$auth