There is this list of Books in the Firebase Realtime Database:
[
{
title: "Don't Make Me Think",
upvotes: 110
},
{
title: "The Mythical Man Month",
upvotes: 111
},
{
title: "Code Complete 2",
upvotes: 112
}
]
By default, the query below returns this list in ASC order:
firebase.database().ref('books').orderByChild('upvotes')
How can I query and order them by upvotes
DESC instead?
var yourVariableName =[]; firebase.database().ref('books').orderByChild('upvotes').on("child_added", (snapshopt) => { yourVariableName .unshift(snapshopt.val()); });
– Raheem Mohamed May 21 '20 at 01:54