Reputation: 43
i have firebase data base as below
projectmasternode
|
-DS
|
----6125675
| |
| ----department:"xyz"
| --projectname:"sad"
|
-----72671273
| |
| --department:"das"
| --projectname:"iuh"
|
-----7863873
|
--projectname:"sad"
department :"xyz"
now how to get departments data where department= "xyz".
Upvotes: 0
Views: 903
Reputation: 4539
Your answer is right in the FB docs. Check here : https://www.firebase.com/docs/web/guide/retrieving-data.html#section-queries and take a look at orderByChild combined with another filter, like endAt. Something like
var ref = new Firebase("myfirebase");
ref.orderByChild("department").endAt("xyz").on("child_added", function(snapshot) {
console.log(snapshot.key());
});
Should do it.
Upvotes: 3