'Firestore query interval in interval
in our scenario the events have a begin and end time stamp, the event may span over 2 days or 3 months
event = {
start: 1652180300308
end: 1653217107596
}
and we want to get a list of all events starting or in progress for this month. Is it possible to make such a query without creating additional fields ?
Solution 1:[1]
On your current data structure you will need to perform a range filter on both start and end to determine whether the event falls into a certain month. As shown in the documentation on Firestore's query limitations, that is not possible:
In a compound query, range (
<,<=,>,>=) and not equals (!=,not-in) comparisons must all filter on the same field.
To allow the query, one solution would be to add an array field with all the months that the event is active in, so that you can then use an array-contains filter on that.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Frank van Puffelen |
