This is the code from your Fiddle:
new Firebase("https://burning-fire-1723.firebaseio.com/WishList")
.startAt('[email protected]')
.endAt('[email protected]')
.once('value', show);
function show(snap) {
console.log(snap.val());
$('pre').text(JSON.stringify(snap.val(), null, 2));
}
And this is the data structure for your WishList in Firebase:
{
"-JQnCbOF1MNdvKUCdDNB": {
"text": "Climb Hill",
"user_id": "[email protected]"
},
"-JQnDG8uWWB167BSSEEI": {
"text": "Deep Sea Diving",
"user_id": "[email protected]"
},
"-JQnDT7w1-K7VSnZNkVI": {
"text": "KICK",
"user_id": "[email protected]"
}
}
It looks like you added these nodes with the Firebase push function. This function will generate a unique name for the node you added. The advantage of this is that you don't have to worry about coming up with a unique name. One disadvantage is that you have no control over the generated name: it's a meaningless blurb.
The problem is with the way you use startAt and endAt. The documentation for startAt says:
The starting point is specified using a priority and an optional child name. If no arguments are provided, the starting point will be the beginning of the data.
The value you are passing to startAt is neither a priority not a name in your Firebase.
If you comment out the startAt and endAt, you'll see all values show up in your pre:
new Firebase("https://burning-fire-1723.firebaseio.com/WishList")
.once('value', show);
function show(snap) {
console.log(snap.val());
$('pre').text(JSON.stringify(snap.val(), null, 2));
}
One solution is to specify the email address as priority value when you add the data. See setPriority and setWithPriority.
Update
To set priorities on the existing nodes, I executed this function in your fiddle:
function setPriorities() {
var list = new Firebase("https://burning-fire-1723.firebaseio.com/WishList");
list.on('child_added', function(snap) {
list.child(snap.name()).setPriority(snap.val().user_id);
});
}
It loops over all the child nodes of your WishList and for each sets the priority. Note that you only need to run this function once, it just adds a priority to the data that is already there. Normally you would specify the priority when you add the element, so you wouldn't need to fix it later.
If you now re-visit your Fiddle, you'll see that it works.
once('value'where you should useonce('child_added'. In addition you are trying to filter on a value other thannameorpriority. I'll see if I can make the fiddle work.