title: How to query highest values if children have dynamic keys in Firebase?
body: <p>I want to get highest scores in leaderboard. Here is my database:</p>
  
  <p><img src="https://i.stack.imgur.com/jF6yo.png" alt="Database"></p>
  
  <p>Here is my rules:</p>
  
  <p><img src="https://i.stack.imgur.com/XSSY8.png" alt="Rules"></p>
  
  <p>And here is my code:</p>
  
  <pre><code>FirebaseDatabase database = FirebaseDatabase.getInstance();
  DatabaseReference newRef = database.getReference("tr/scores");
  newRef.orderByChild("skor").limitToLast(3).addListenerForSingleValueEvent(new ValueEventListener() {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              Gson gson = new Gson();
              String value = gson.toJson(dataSnapshot.getValue());
              Log.d("Debug",value);
          }
          @Override
          public void onCancelled(DatabaseError firebaseError) {
              Log.e("Debug","Error at firebase response.");
          }
      });
  </code></pre>
  
  <p>This returns 3 childs but not ordered by "skor" variable. I read the docs but the example in docs is:</p>
  
  <pre><code>{
    "scores": {
     "bruhathkayosaurus" : 55,
     "lambeosaurus" : 21,
     "linhenykus" : 80,
     "pterodactyl" : 93,
     "stegosaurus" : 5,
     "triceratops" : 22
    }
  }
  </code></pre>
  
  <p>But my database has dynamic keys for each childs. Any idea?</p>