简体   繁体   中英

Where does AngularFire (using Firestore) actually filter data?

According to this tutorial about querying collections:
https://github.com/angular/angularfire/blob/master/docs/firestore/querying-collections.md
filtering in the angularFire can be done it two ways:

  • using ref, for example: afs.collection('items', ref => ref.where('size', '==', 'large'))
  • using pipe, for example afs.collection('items').valueChanges().pipe(filter(...))

The question is, where the filtering is actually happening in the first option. Reasonable would be to process it on the server-side, however, I couldn't find any information about it in the documentation, in case of large databases fetching whole collections at first might be extremely expensive.

In the first option the filtering is done on the Firestore servers, and you can use any regular Firestore query operation . I'd only recommend piping into a client-side filter if your use-case can't be implement as a Firestore query, and you can predict how big your data set will be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM