My database consists of a collection called songs which has fields: artist, email, link and name. At the moment the email field in all documents is an empty string. Here is a pic of one of the entries.
Here is the query that I'm running in my android app:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration);
firebaseAuth = FirebaseAuth.getInstance();
FirebaseFirestore db = FirebaseFirestore.getInstance();
TextView userinfo = (TextView)findViewById(R.id.link);
FirebaseUser userauth = firebaseAuth.getCurrentUser();
db.collection("songs").whereEqualTo("email",userauth.getEmail()).get().addOnCompleteListener(new OnCompleteListener<QuerySnapshot>(){
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
// Document found in the offline cache
userinfo.setText("User found");
} else {
userinfo.setText("User not found");
}
}
});
}
The TextView is printing User found even though all the email entries are empty strings. The expected behavior is User not found.