Javascript 比较.where()中的firestore时间戳不起作用

Javascript 比较.where()中的firestore时间戳不起作用,javascript,react-native,google-cloud-firestore,Javascript,React Native,Google Cloud Firestore,这是我的代码: 。。。 const submitted_at=线程[0]。data.submitted_at.toDate(); 常数ref=firestore() .collection('Discover') .where('submitted_at'、'>'、`${submitted_at}`) //还尝试使用新日期(提交时间)进行比较,但仍然不起作用 .orderBy('submitted_at','desc') .限额(10); ... QuerySnapshot始终为空 这是一个p

这是我的代码:

。。。
const submitted_at=线程[0]。data.submitted_at.toDate();
常数ref=firestore()
.collection('Discover')
.where('submitted_at'、'>'、`${submitted_at}`)
//还尝试使用新日期(提交时间)进行比较,但仍然不起作用
.orderBy('submitted_at','desc')
.限额(10);
...
QuerySnapshot
始终为空

这是一个pull-to-refresh查询,其目的是获取在检索到第一个文档之后提交的文档


非常感谢您的帮助。

在这里,您似乎正在将日期转换为字符串:

.where('submitted_at', '>', `${submitted_at}`)
那是行不通的。如果要将日期传递给查询以与时间戳字段进行比较,请不要将其转换为任何其他内容。它必须是日期类型:

.where('submitted_at', '>', submitted_at)

在这里,看起来您正在将日期转换为字符串:

.where('submitted_at', '>', `${submitted_at}`)
那是行不通的。如果要将日期传递给查询以与时间戳字段进行比较,请不要将其转换为任何其他内容。它必须是日期类型:

.where('submitted_at', '>', submitted_at)