用户可以在我的应用中发布。然后像这样存储在firebase中
我想获取上周发布的所有帖子。我的搜索查询中需要一些过滤器。但是我不知道该怎么办。
这是我的搜索查询
_newQuerySnapshot = await Firestore.instance
.collection("posts")
.orderBy("createdAt", descending: true)
.startAfterDocument(lastDocument)
.limit(5)
.getDocuments();
我需要这样.where(//上周发布)
请帮我 。
最佳答案
或者你可以这样做
var startfulldate = admin.firestore.Timestamp.fromDate(new
Date(1556062581000));
db.collection('mycollection')
.where('start_time', '<=', startfulldate)
.get()
.then(snapshot => {
var jsonvalue: any[] = [];
snapshot.forEach(docs => {
jsonvalue.push(docs.data())
})
res.send(jsonvalue);
return;
}).catch( error => {
res.status(500).send(error)
});
关于firebase - Flutter Firebase时间戳搜索查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61973635/