我想从消防局获得每月的水数据,因为我尝试了所有的文件,但没有任何工作,我想我可以通过时间戳和水场的帮助获得数据,在我的数据库中,任何人都可以帮助我。这是我的数据库。

我尝试了最后一个答案,但是控制台上没有显示任何东西。
const cloudDb = app.firestore();
var time="1638297000"
var lasttime="1640845799"
cloudDb.collection('AKVO_RND')
.where('timestamp', '>=', time)
.where('timestamp', '<=', lasttime )
.orderBy('timestamp', 'desc')
.get().then(function(querySnapshot){
querySnapshot.forEach(function(doc){
water= (doc.data().water)
console.log(water);
})
})
发布于 2022-01-17 07:33:16
您可以借助firebase函数进行类似的查询:
firestore().collection('AKVO_RND')
.where('timestamp', '>=', time)
.where('timestamp', '<=', lastdate)
.orderBy('timestamp', 'desc')
.get();确保使用runTimeOptions。它将允许您的函数运行比建议的时间更长的时间。
https://stackoverflow.com/questions/70737756
复制相似问题