Firebase queryOrderedByChild() method not giving sorted data
<p>My database structure is some thing like this:</p>

<pre><code>{
  "users": {
    "alovelace": {
      "name": "Ada Lovelace",
      "score": 4,
    },
    "ghopper": { ... },
    "eclarke": { ... }
  }
}
</code></pre>

<p>I am trying to retrieve top 20 scores in descending order.</p>

<pre><code>let queryRef = FIRDatabase.database().reference().child("users").queryOrderedByChild("score").queryLimitedToLast(20)
queryRef.observeSingleEventOfType(.Value, withBlock: { (querySnapShot) in
      print(querySnapShot.value)
})
</code></pre>

<p>i am trying to get output like</p>

<pre><code>score": 4
score": 3
score": 2

or 

score": 2
score": 3
score": 4

or 

2
3
4
</code></pre>

<p>Please let me know how to solve this. </p>