Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query doesn't send me back an empty array. #349

Open
Jcardo97 opened this issue Apr 6, 2018 · 2 comments
Open

Query doesn't send me back an empty array. #349

Jcardo97 opened this issue Apr 6, 2018 · 2 comments

Comments

@Jcardo97
Copy link

Jcardo97 commented Apr 6, 2018

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);
});
});

@saintedlama
Copy link
Collaborator

Could you provide some data as well as the console log output for a certain scenario given date1 and date2

@Jcardo97
Copy link
Author

Jcardo97 commented Apr 10, 2018

2018-04-10_12-51-25

Yes no problem, use date in epoch format because it is more easy to save the date.
https://ufidelitas.ac.cr/assets/en/Josue/2018-04-10_12-51-25.png
In that URL we can see output from date1 (date begin) and date2 (date end) and empty array.
In another site i make a request from all the information in the collection and send me back all information with date . Attached URL with Image
https://ufidelitas.ac.cr/assets/en/Josue/2018-04-10_12-54-29.png
2018-04-10_12-54-29

and whem I use that information to make a consult directly from database it work´s.

Thanks for help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants