orderby angularfire code example
Example: orderBy firebase angular
import { map, take } from 'rxjs/operators';
import { Observable } from 'rxjs';
public allProducts: Observable<any[]>;
public amazonCollection: AngularFirestoreCollection;
this.amazonCollection = this.afs.collection('amazon', (ref) =>
ref.orderBy('voteCount')
);
this.allProducts = this.amazonCollection.snapshotChanges().pipe(
map((actions) => {
return actions.map((a) => {
return { id: a.payload.doc.id, ...a.payload.doc.data() };
});
})
);