title: firebase cloud function for sorting values
body: <p>I want to write a cloud function for firebase that can sort data by values, but it's not working. Here is my code</p>
  
  <pre><code>exports.membersposition = functions.database.ref('/queues/{queueid}/members').onWrite(event =&gt; {
  const membersRef = event.data.ref;
  
  return membersRef.orderByChild('timestamp').on('child_added')
      .then(snapshot =&gt; console.log(snapshot.key()));
  });
  </code></pre>
  
  <p>Can any body fix this</p>