Firestore - 如果放在 return 代码中,OrderBy 将不起作用
Firestore - OrderBy won't work if placed inside return code
我想按 "Time" 排序我的数据,但每当我尝试添加 .orderby("time") 时,它都会显示错误。
我的获取函数
return this.firestore.collection('East_Area').snapshotChanges();
我试过这样做:
return this.firestore.collection('East_Area').orderBy("time").limit(3).snapshotChanges();
我是不是做错了什么?如有任何帮助,我们将不胜感激!
改变这个:
return this.firestore.collection('East_Area').orderBy("time").limit(3).snapshotChanges();
进入这个:
do this then: return this.firestore.collection('East_Area', ref => ref.orderBy("time")).snapshotChanges()
snapshotChanges()
是 angulareFire
中的一个方法,但您使用的是纯 javascript,因此您需要使用 get()
方法来检索数据。
我想按 "Time" 排序我的数据,但每当我尝试添加 .orderby("time") 时,它都会显示错误。
我的获取函数
return this.firestore.collection('East_Area').snapshotChanges();
我试过这样做:
return this.firestore.collection('East_Area').orderBy("time").limit(3).snapshotChanges();
我是不是做错了什么?如有任何帮助,我们将不胜感激!
改变这个:
return this.firestore.collection('East_Area').orderBy("time").limit(3).snapshotChanges();
进入这个:
do this then: return this.firestore.collection('East_Area', ref => ref.orderBy("time")).snapshotChanges()
snapshotChanges()
是 angulareFire
中的一个方法,但您使用的是纯 javascript,因此您需要使用 get()
方法来检索数据。