0

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".

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Never did it myself in IOS, but I guess it should be pretty much the same, check here : firebase.com/docs/ios/guide/…
It's pretty much the same. And pretty well covered in the docs. Note that equalTo ( queryEqualToValue in iOS) would be preferable to endAt in this case, since we're emulating where x = y.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.