My firebase data looks something like this:
{
\"lambeosaurus\": {
\"date\" : 1420753443,
\"length\" : 12.5,
\"weight\": 5000
},
\"stegosaur
Looks like you can use the orderBychild()
method to order by child key or property (i.e. weight
, length
, or date
). And if you chain that using startAt()
& endAt()
, we can construct the query you're looking for:
var startDate = 14200000000;
var endDate = 14300000000;
ref.orderByChild("date").startAt(startDate).endAt(endDate)
.on("child_added", function(snapshot){
console.log("got the data!", snapshot);
});