I am new to firebase and have read through the docs, but can't seem to find a away to get a list of all Ladders with populated User data. I don't really want to duplicate the user data in every ladder they are a member of.
Here is my data structure:
{
"ladders" : [ {
    "description" : "Real Real Tennis",
    "name" : "Ping Pong",
    "players" : {
      "simplelogin:5" : true
    }
  }, {
    "description" : "Real Tennis",
    "name" : "Mario Tennis",
    "players" : {
      "simplelogin:5" : true
    }
  } ],
  "users" : {
    "simplelogin:5" : {
      "email" : "bob@bob.com",
      "md5hash" : "1e737a7b6e1f0afb1d6fef521097400b",
      "name" : "Bob",
      "username" : "bob1"
    }
  }
}
Here is my best attempt, but it looks like the ladders lookup finishes and returns before the users lookup is done so it returns with players being empty.
laddersRef.on('value', function(laddersSnapShot){
        var ladders = []
        laddersSnapShot.forEach(function(ladderData) {
            var ladder = ladderData.val();
            ladder.players = [];
            ladder.id = ladderData.key();
            laddersRef.child(ladder.id).child('players').on('value', function(snap){
                snap.forEach(function(player){
                    usersRef.child(player.key()).on('value', function(snap1){
                        ladder.players.push(snap1.val())
                    })
                })
            })
            ladders.push(ladder)
        });
    });