Hi, so I am trying to query reservations that are between two dates.
So for example, if I have a reservations from
2023/02/17 to 2023/03/19 ,
2023/03/20 to 2023/04/22 and
2024/06/19 to 2024/05/19
and check against a reservation for 2023/03/18 to 2023/03/28 would return the first two reservations.
My current code is this, but it returns basically all results. I am not sure on how to check if the reservation is between the two dates, since there’s also basically no “and” operator from what I was able to find in the docs.
I what I shared, I used the variables start and end initialized with new Date() of startDate and endDate respectively so that the matched is not polluted with the same expressions twice. And to make it clear that they are variables rather than field names. A newbie might be confused and thing that startDate the field name is the same as startDate your variables.
What I suspect is that in your version of $match, new Date() is not called so the dates in the input