我正在尝试检索日期字段(类型为timestamp)小于当前系统时间的所有文档。我的打字稿文件中的AngularFirestore查询看起来像这样。
this.afs.collection<events>('events' , ref => ref.where('date' , '<' , Date.now())).snapshotChanges();
以上查询不包含任何文档。
将不胜感激。
刚刚在我的应用程序上进行了测试,我想您的数据库中有日期(or actually a Timestamp),因此您应该将该字段与日期对象进行比较:
this.afs.collection<events>('events' , ref => ref.where('date' , '<' , new Date())).snapshotChanges();