I am trying to check if "1122334455" (mobile number) is a child within the "Teachers" node. Computer Science and Mechanical are both departments, and both include mobile numbers as their Childs.
I am able to check if a mobile number exists at a particular path using this
reference = FirebaseDatabase.getInstance().getReference("Person/Teachers/Computer Science");
if(snapshot.hasChild(mobile_number))
{
}
But what I want to achieve is to determine if the person exists using just their mobile number when it is not known if they're teacher or student, whether they belong to CS or mechanical. But this code does not work.
reference = FirebaseDatabase.getInstance().getReference("Person/");
if(snapshot.hasChild(mobile_number))
{
}
Also tried snapshot.child(mobile_number).exists(), that also doesn't work.