title: Firebase how to sort collection via createdAt field?
body: <p>I have a collection model that looks like this : </p>
  
  <p><a href="https://i.stack.imgur.com/gW05K.png" rel="nofollow"><img src="https://i.stack.imgur.com/gW05K.png" alt="enter image description here"></a></p>
  
  <p>How do I sort the query from latest to oldest via the <code>createdAt</code> field.</p>
  
  <p>So far I tried </p>
  
  <pre><code>db.ref('accounts')
      .startAt()
      .orderByChild('createdAt')
      .once('value')
      .then(function(snap){
          // do shits here...
      })
  </code></pre>
  
  <p>But am getting the data the oldest on top. </p>
  
  <ol>
  <li>January</li>
  <li>February</li>
  <li>March</li>
  </ol>
  
  <p>But I want </p>
  
  <ol>
  <li>March</li>
  <li>February</li>
  <li>January</li>
  </ol>