I'm currently working on a backend build with MERN and Typescript.
The problem comes when i try to compare Dates, which are are saved in Mongo as Date(ISODate(for example: "2022-09-14T16:00:00.000+00:00") and get compared to a string (for example: "2022-14-09").
I tried to convert the string with the Help of new Date(string) and compare then, but unfortunately it didn't work. I tried several Methods but they all don't work.
Do you have an idea?
data = await collections.events
?.find({
location: params["place"],
persons: { $gte: parseInt(params["persons"], 10) },
time: { $gte: new Date(params["date"]) },
})
.toArray();