首页 > 解决方案 > Query specific day in Firestore

问题描述

I'm trying to query for a specifing date in Firestore. Until now I have tried this code:

let ref = db.collection('schools').doc('DglhflywuybkOuCq7tGW')
let start = new Date('2018-04-27')
let end = new Date('2018-04-28')
let reportRef = ref.collection('reportes').where('date', '>', start).where('date', '<', end)

In this code I need two variables, one for storing the start day (the one I'm looking) and the end, which is the start plus 1 day more. After that I query for the intersection of the two.

Is this the right way or there is a simpler way?

标签: javascriptfirebasevue.jsgoogle-cloud-firestore

解决方案


推荐阅读