我正在尝试检查文档是否存在于集合中。但当我进行查询时,它返回false,但正如您在照片中看到的,文档是存在的,所以我哪里做错了?
public MutableLiveData<Boolean> isConversationNodeExsits(String documentID) {
if (isConversationNodeExsits == null ) {
isConversationNodeExsits = new MutableLiveData<>();
db.collection(Constants.CONVERCTION_ID)
.document("13005065233@umt,edu,pk---sifusir@fidelium10,com")
.get()
.addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
if (task.getResult().exists()) {
Log.d(TAG, " conversation node exists ");
isConversationNodeExsits.setValue(true);
} else {
Log.d(TAG, " conversation node not exists " + task.getResult().getReference().getPath());
isConversationNodeExsits.setValue(false);
}
}
});
}
return isConversationNodeExsits;
}