Problem with MongoDB compare date

I have a problem comparing Dates in Retool when querying MongoDB.

I have a date_created type Date field. I need to get the data between the start and end dates.

I make a query:
$gte: {{new Date(dateRange1.value.start).toISOString()}}
$lt: {{new Date(dateRange1.value.end).toISOString()}}

But I get an empty result. Not a single line fits this range. I checked, the strings are exactly there. But the comparison fails. What could be the problem?

Hey @Emonkey!

Can you try running the query using MongoDB date objects? Something like the following:

    $gte: {$date: {{dateRange1.value.start}} } ,
    $lt: {$date: {{dateRange1.value.end}} }

Let me know if that works or if you still run into issues!