Hi guys!
I need help. I'm trying to make a query, but the array is empty and I can not see the error in my code. The data is getting right to the back end and if I use the same data in a direct query from the mongo shield if I return the data.
I appreciate any help you can give me.
I attach my code
router.get('/tasks/:date1/:date2', (req, res, next) => {
console.log(req.params.date1);
console.log(req.params.date2);
db.studentServices.find({ "Fecha" : {$gte: req.params.date1, $lte : req.params.date2}}, (err, studentService) => {
if(err) return next(err);
console.log(studentService);
res.json(studentService);
});
});
Hi guys!
I need help. I'm trying to make a query, but the array is empty and I can not see the error in my code. The data is getting right to the back end and if I use the same data in a direct query from the mongo shield if I return the data.
I appreciate any help you can give me.
I attach my code
router.get('/tasks/:date1/:date2', (req, res, next) => {
console.log(req.params.date1);
console.log(req.params.date2);
db.studentServices.find({ "Fecha" : {$gte: req.params.date1, $lte : req.params.date2}}, (err, studentService) => {
if(err) return next(err);
console.log(studentService);
res.json(studentService);
});
});