Sorting in descending order in Firebase database

Viewed 57100

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?

1 Answers
Related