Hi there,
When I query Firebase database by using db.getValue(…) or db.getUserValue(…) functions with orderByChild parameter the returned value looks like it is not sorted. Schema is like below:
+ addresses
– -LN0JJpV0r1dZbraSYrH
– name: “abc”
…
db.getUserValue("addresses", { orderByChild: "name"}, function(success, key, value) { ... }
Problem is due to the fact that “value” passed to the callback function is already a javascript object and when javascript converts data to object its sorting is redesigned arbitrarily by javascript engine. So, Firebase returns the data in required order, however, Javascript loses the returned order by mixing things up.
- Is there a way to get the data with its correct order without making changes in the database schema with current implementation of Felgo Firebase plugin?
- Is there a way to incorporate “child_added” callback style where callback function is called per each key returned from the query? Currently the whole query is returned as an object in a single callback function call.
Best
Furkan