Querying AngularFire2

0

I can not find documentation on how to query in this case using ref.where () and orderBy () If the return I do using the where () I have no problem, but when I want to sort the results of form 'desc' does not return anything. I'm using:

  

Angular: 6.1.6

     

"angularfire2": "^ 5.0.0-rc.12",

this.figurasCollection = this.afs.collection<any>('figuras', ref => {
  const query = ref.where('year_torneo', '==', '2019_apertura')
            .where('division', '==', 'a_fds') ;
  query.orderBy('goles', 'desc');
  return query;
});
    
asked by Fabricio Loupias 05.09.2018 в 20:42
source

1 answer

0

According to your code should work, anyway try this:

    this.figurasCollection = this.afs.collection<any>('figuras', ref => {
        return ref.where('year_torneo', '==', '2019_apertura')
                  .where('division', '==', 'a_fds')
                  .orderBy('goles', 'desc');
      });

regarding the documentation for the Query: link

    
answered by 04.10.2018 в 19:23