Get all keys from table in firebase
<p>This is the structure of the <code>users</code> table in Firebase:</p>

<pre><code>users
 |
 +- 12345
       |
       + firstName: .....
       + lastName: .....
 |
 +- 67890
       |
       + firstName: .....
       + lastName: .....
</code></pre>

<p>What I want to do is collect all the keys within the <code>users</code> table and store them in an array. For example, on return the array would be like: <code>[ 12345, 67890 ]</code><br></p>

<p>What I have so far:</p>

<pre><code>var getAllUsersOrderByKey = function() {
    var deferred = $q.defer(),
        userRef = firebase.database().ref('users/').orderByKey();

    userRef.once("value").then(function(snapshot) {
        deferred.resolve(snapshot);
    });
    return deferred.promise;
}
</code></pre>

<p>What's called back is just the object of current user that is logged.</p>

<p>I already have fucntions setup that provide the relevant data when a member key is passed in (i.e. <code>firstName</code>)</p>

<p>What I am trying to do, is to get all of the keys within the users table into an array. Loop through that array and get the details of each user and push that data into another array so I can do stuff with it.</p>

<p>I apologise if this is a really straight forward question and that I am missing something in the docs</p>