So I want to know if there is a way to query based on inner child without having to know the parent in Firebase Database? Here is the exact situation:
As shown in the image, I want to query the entire data snapshot where title = "bj", since I have pushed them automatically so Im unaware of the Key (or parent in this case). Im curious if Fb Query has anyway to look into the nested childs directly? TIA
private void fetchPinnedLocationsForSearchbar(String key) {
Query query = MyApplication.database.getReference("/pins/").child("title").orderByKey().equalTo(key);
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
Log.e("-->X-DATA-FROM-QUERY", dataSnapshot.toString());
for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) {
final BusinessModel pinItModel = new BusinessModel();
if (((Boolean) dataSnapshot1.child("ifBusiness").getValue())) {
if
BusinessModel pinItModelTest = dataSnapshot1.getValue(BusinessModel.class);
Log.e("->PicCount", pinItModelTest.getPicCount() + "");
//
_data.add(pinItModelTest);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}