When I get all the data from the database without any query, I get the last entries from the database (keys are generated to work this way). Something like this:
var ref = firebase.database().ref('myObj').limitToFirst(100);
ref.on("value", function(snap){
console.log(snap.val());
});
This way I get all the objects I need ordered properly. But if I add a query to filter some data, I lost the order from the original.
var ref = firebase.database().ref('myObj').orderByChild('myChild').equalTo('myproperty').limitToFirst(100);
ref.on("value", function(snap){
console.log(snap.val());
});
This way I am not receiving the most recent data as I get when I don't apply any filter.
How can I solve that?