I am writing an HTML/JavaScript app that uses Firebase as the database.
My data is structured somewhat like this:
steps/
- GUID
-- tripId
-- name
-- description
-- order
-- launchDate
I want to select any items from steps whose tripId matches a specific value (passed in a variable). I then want to order the results by descending order.
I am more use to T-SQL type syntax so am getting confused in the world of realtime databases.
Here is a snippet of what my code looks like now.
var steps = function readSteps(format, tripId) {
var stepsRef;
stepsRef = firebase.database().ref('steps/');
stepsRef.orderByChild('order').on('value', function (response) {
// DO SOME LOGIC HERE WITH 'response' DATA
});
}
I don't know how to filter these results and I don't see how to easily do a descending sort. order is an integer.