查询firebase.start今天日期之后

时间:2020-09-05 21:43:46

标签: angular firebase google-cloud-firestore

我有一个查询,该查询为特定用户选择并显示所有“即将到来的”计划约会,并按日期对其进行排序。我还希望选择日期为今天及以后的文档。

return this.afs.collection('schedule', ref => ref.where('uid', '==', id).orderBy('date').startAfter(Timestamp)).snapshotChanges();

在没有'.startAfter'的情况下,查询工作正常,但是我似乎无法使该部分正常工作。 。 有什么想法吗?

谢谢。

2 个答案:

答案 0 :(得分:0)

尝试一下:

return this.afs.collection('schedule', ref => ref.where('uid', '==', id)
.orderBy('date')
.where("date", ">", Timestamp)
.snapshotChanges();

答案 1 :(得分:0)

我知道了:

today = new Date();

然后...

return this.afs.collection('schedule', ref => ref.where('uid', '==', id).orderBy('date').where("date", ">=", this.today).snapshotChanges()