Answer the question
In order to leave comments, you need to log in
How to get data from MongoDB by date in Node.js?
To work with MongoDB I use node-mongodb-native . I need to update some records once a day. To get them, I write the following code:
var date = new Date;
date.setDate(date.getDate()-1);
itemsDB.find({
name: item.name,
date: {$gte: date.toISOString()}
}).toArray(function(doc)
{
// обработка пришедших документов
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question