I'm trying to filter some information by date and in my database the dates are saved with this format:
2018-05-23T23:00:00.000+00:00
this is what I tried to do
router.get('/byDate', function (req, res) {
req.query.fromDate
req.query.toDate
Schedule.find({ date : {
$lt: new Date(req.query.toDate).toISOString(),
$gte: new Date(req.query.fromDate).toISOString()
} } , function(err, data){
if(err) throw err;
res.json(data);
});
});