I have been stuck on this issue for several days now, unable to find a solution even after extensive searches online.
In my MongoDB database, each object contains a property called "myDate" that is stored in the ISODate format.
When searching within the project, I input the date in the yyyy-mm-dd format, such as 2003-04-28.
To match this date in MongoDB, I use $match to compare the "myDate" property in each object:
const $match = {};
if(searchedDate) {
$match['myDate'] = searchedDate
}
However, the date is stored in the database in the following format:
{
"myDate": ISODate("2023-04-28T00:00:00.000+0000)
}
The code runs without errors, but the response body shows "No Content."
In another collection within the same project, the date was actually the ID of each object, making it easy to retrieve the correct object based on the date. But in this case, I am struggling to find a solution.
If anyone could provide a bit of guidance or suggest some ideas for solving this issue, I would greatly appreciate it.