where query in firebase

Issue

I am new in Firebase. I have problem while executing query:

new Firebase("https://blazing-fire-2739.firebaseio.com/users")
        .startAt($scope.user.email) //karank@ocodewire.com
        .endAt($scope.user.email)
        .once('value', function(snap) {
           console.log('accounts matching email address', snap.val())
        });

This shows me null.

In Firebase:

users
   -JxFNEu31LJ0Efy8PnX5
      email: karank@ocodewire.com
      firstname:karan 
      lastname: sofat

Please Help

Solution

.startAt and endAt doesn’t accept a string, it accept a number where to start/end at. So you would have to change to

new Firebase("https://blazing-fire-2739.firebaseio.com/users")
  .startAt(1)
  .endAt(50)
  .once('value', function(snap) {
    console.log('accounts matching email address', snap.val());
});

Or just leave out the endAt() altogether.

Answered By – Chrillewoodz

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published