I am trying to figure out how to filter products based on their child nodes in Firebase.
My setup is as follows:
products/ product1 /author: 12345 /title: "Awesome" /description: "more awesome" product2 /author: 67890 /title: "Awesome" /description: "more awesome"
How can I request Firebase so that I retrieve only those products for which it has the value child($productId).child(author) equals 12345 ?
I tried the following, but this clearly does not work. I need a way to filter on subdir:
var ref = new Firebase(FBURL); // Attach an asynchronous callback to read the data at our posts reference ref.child("products").child('$productId').child('author').equalTo(12345).on("value", function(snapshot) { console.log(snapshot.val()); }, function (errorObject) { console.log("The read failed: " + errorObject.code); });
source share