Fajar Syairillah :
i'm trying to get the data based on "Payments" in child "State" in my structured data My Structured firebase
I used this
salesRef = FirebaseDatabase.getInstance().getReference()
.child("Orders")
.orderByKey().startAt("Payments").endAt("Payments"+"\uf8ff");
but i got nothing back.What was wrong ? What should i use?
Peter Haddad :
You need to do the following:
salesRef = FirebaseDatabase.getInstance().getReference().child("Orders").orderByChild("state").equalTo("Waiting Payments Config");
orderByChild
will take the name of an attribute as an argument and, equalTo
will take the value of that attribute as an argument.
Check the docs:
https://firebase.google.com/docs/database/android/lists-of-data