title: Using AngularFirestore Collection orderBy with snapShotChanges method
body: <p>I have below code in an Angular application which is using AngularFire2.</p>
  
  <p>TypeScript:</p>
  
  <pre><code>constructor(db: AngularFirestore) {
      this.booksCollectionRef = db.collection&lt;Book&gt;('books');
  
      this.books = this.booksCollectionRef.snapshotChanges().map(actions =&gt; {
          return actions.map(action =&gt; {
              const data = action.payload.doc.data() as Book;
              const id = action.payload.doc.id;
              return { id, ...data };
          });
      });
  }
  </code></pre>
  
  <p>HTML: </p>
  
  <pre><code>&lt;md-list&gt;
      &lt;md-list-item *ngFor="let book of books | async"&gt;
          &lt;h4 md-line&gt;{{book.name}}&lt;/h4&gt;
      &lt;/md-list-item&gt;
  &lt;/md-list&gt;
  </code></pre>
  
  <p>This code retrieves and binds data as expected (removes items when collection updated), now I want to sort the collection by a given column. I tried to use firebase <a href="https://firebase.google.com/docs/firestore/query-data/order-limit-data" rel="noreferrer">orderBy</a> clause, but I can not figure out how to use it with <code>snapShotChanges()</code> method.</p>