2

I am trying to figure something out that is extremely important, which seems extremely easy, but I am just running into a wall. I have a Firebase project setup with Angular (using AngularFire). There are many points in application where records are added as an Array, which firebase structure with weird keys like this:

    logs
      -HD93Yt6vm9lXpOWDA09
          type: 'status'
      -HD93Yt6vm9lXpOWDA09
          type: 'message'
      -HD93Yt6vm9lXpOWDA09
          type: 'status'

How would I go about making a query for just the logs with a type of 'status'? Currently trying something with this:

// create a reference to the Firebase where we will store our data

var ref = new Firebase("https://myFBapp.firebaseio.com/logs");
$scope.logs = ref.[how do I select these records]?

It's easy enough to do if you know the id of the thing you want, so I could use logs->logId->type.. but this is stumping me. I apologize for the newbness in advance.

  • 1
    You'd use `ref.orderByChild('type').equalTo('status')` and then bind that to your scope with `$scope.logs = $firebaseArray(ref);`. See https://www.firebase.com/docs/web/guide/retrieving-data.html#section-queries – Frank van Puffelen Mar 19 '15 at 14:06
  • possible duplicate of [Get users by name property using Firebase](http://stackoverflow.com/questions/14963776/get-users-by-name-property-using-firebase) – Frank van Puffelen Mar 19 '15 at 14:06

0 Answers0