I want to check the entered text (EditText) element is exist or not using Firestore Collection if Exists where exists or fetch the remain elements Note: we don’t have document id
I want to mobile if our user collection the mobile exists then fetch the remain elements the document id will Random using AutoID and ignore Additional Collections like Withdraw Requests
I write this code in my activity
private void fetchDatafromFirestoreCollection() {
firestore.collection("Users").addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(@Nullable QuerySnapshot value, @Nullable FirebaseFirestoreException error) {
if (error != null) {
if (dialog.isShowing())
dialog.dismiss();
Log.e(TAG, "Error is: ", error);
return;
}
for (DocumentChange documentChange : value.getDocumentChanges())
}
});
}
2
Answers
Make the document structure like this one:
Hope its work..
According to this comment:
And this comment:
To solve this, you have to use a query that looks like this:
The result in the logcat will be: