Mithu
Mithu

Reputation: 655

Firebase Query From Multiple Nested Child

I have below firebase database structure. I an trying to query m_no which is nested under a dynamically created arraylist

enter image description here

below is the code i have tried but it is not working.Any idea how to query this?

 mReferenceBooks=mDataBase.getReference("book").child("dMoble");

 mReferenceBooks.orderByChild("m_no").equalTo(emailID).addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(DataSnapshot dataSnapshot) {
  }

Upvotes: 0

Views: 97

Answers (1)

Peter Haddad
Peter Haddad

Reputation: 80914

The query wont work because above the dMoble, you have the random id. Therefore you need to access that id and add it as a child() to be able to query:

mReferenceBooks=mDataBase.getReference("book").child("-Ly3FuE6GF-oExG2puhj").child("dMoble");

Upvotes: 1

Related Questions