我正在运行firestore查询以获取数据,但查询先前从缓存的数据查询返回数据,然后在服务器的第二次传递中返回其他数据(之前未查询)。有没有办法可以禁用firestore查询的缓存,以便每次查询时请求都会转到DB。
this.parts$ = this.db.collection<OrderBom>('OrderBom', ref => {
let query : firebase.firestore.Query = ref;
query = query.where('orderPartLC', '==', this.searchValue.toLowerCase());
return query;
}).valueChanges();
如果使用AngularFire2,您可以尝试:
// fireStore is a instance of AngularFireStore injected by AngularFire2
let collection = fireStore.collection<any>("my-collection-name");
let options:GetOptions = {source:"server"}
collection.ref.get(options).then(results=>{
// results contains an array property called docs with collection's documents.
});