node.js - Firestore:如何查询特定时间戳(相等)
问题描述
我希望以下查询起作用
await admin.firestore().collectionGroup(`calenders`).where('appointments', 'array-contains', admin.firestore.Timestamp.fromDate(now)).get()
我有调试数据要测试
const testDate= new Date(2000, 3, 3, 23, 0, 0, 0)
console.log(testDate)
console.log(admin.firestore.Timestamp.fromDate(testDate))
我还以完全相同的方式打印了与 testDate 匹配的文档的时间戳。
Output for test date:
2000-03-03T23:00:00.000Z
Timestamp { _seconds: 952124400, _nanoseconds: 0 }
Output for real document date
2000-03-03T23:00:00.000Z
Timestamp { _seconds: 952124400, _nanoseconds: 0 }
这显然是一样的。现在我检查了。为了比较时间戳,有一个方法叫做isEqual(Timestamp other)
. 这是否意味着除了将时间戳存储在另一种数据格式中之外,没有其他方法可以使查询工作?
解决方案
推荐阅读
- matlab - 将 Matlab 中由相同整数索引的矩阵的列求和
- javascript - 加载画布时精灵不出现
- ios - 当从视图 A 切换到视图 B 时,A 的视图控制器会发生什么?
- ruby-on-rails - byebug 在我输入时没有显示输出
- ruby-on-rails - Ruby on Rails - “原因:找不到图像”
- javascript - 即使系统设置不正确,如何在 JavaScript 中找到正确的时区?
- reactjs - 提供反应网页的替代方式
- python - SymPy 中 1/x 的集成
- javascript - 如何将:悬停和单击事件同时添加到元素?
- spring-boot - 带有弹簧引导的弹性 PreBuiltTransportClient 创建内存泄漏