title: Firebase Javascript: Get id of the first child
body: <p>I'm trying to get the id of the first child in my database, but it returns "undefined". Below is my code, and how my data is structured:</p>
  
  <pre><code>var database = firebase.database().ref();
  var postsRef = database.child("posts");
  postsRef.orderByChild("date").limitToFirst(1).once("value", function(snapshot) {
      console.log(snapshot.ref.parent);
  });
  </code></pre>
  
  <p>And this is how my data is structured:</p>
  
  <pre><code>posts
      1
          date
          title
          alias
          timestamp
      2
          date
          title
          alias
          timestamp
      3
          date
          title
          alias
          timestamp
  </code></pre>