0

This is my Database structure

I want retrieve movie name that type is action.I use this query but it didn't work.

  Query query = mRef.child("Movie").orderByChild("1").equalTo("Action");

How can I retrieve movie name that type is action?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • add the data structure, so we could understand how you are saving data in the database. – Harish Kamboj Jan 25 '17 at 17:51
  • You're using an array to model what is essentially a set. There are many reasons to not use arrays in Firebase and this is one of them. For one way to model this type of relation, see http://stackoverflow.com/questions/40656589/firebase-query-if-child-of-child-contains-a-value – Frank van Puffelen Jan 25 '17 at 20:34

1 Answers1

0

Action is under type node, so modify your query.

Query query = mRef.child("Movie").orderByChild("1").child("Type").equalTo("Action");
Rahul
  • 10,457
  • 4
  • 35
  • 55