Skip to content

Instantly share code, notes, and snippets.

@nickeblewis
Created January 20, 2015 14:56
Show Gist options
  • Select an option

  • Save nickeblewis/f092fa42226bf5f738b0 to your computer and use it in GitHub Desktop.

Select an option

Save nickeblewis/f092fa42226bf5f738b0 to your computer and use it in GitHub Desktop.
Firebase - how to perform nested queries to get grandchildren who are equal to 10
var fathersRef = new Firebase('https://your.firebaseio.com');
fathersRef.on('child_added', function(fatherSnap) {
fatherSnap.ref().on('child_added', function(childSnap) {
childSnap.ref().orderByChild('age').equalTo(10).on('child_added', function(grandchildSnap) {
\\ Do something with the grandchild
var grandChild = grandchildSnap.val();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment