I need some help finding a record by date in mongodb and nodejs.
I add the date to the json object in a scraping script as follows:
jsonObj.last_upda
To clarify. What is important to know is that:
Here is a working snippet of code, where we do a little bit of date manipulation to ensure Mongo can handle it correctly. In this example, I am using mongoose module and want results for rows whose date attribute is less than (ie. before) the date given as myDate param.
var inputDate = new Date(myDate.toISOString());
MyModel.find({
'date': { $lte: inputDate }
})