Skip to content

Instantly share code, notes, and snippets.

@iworkforthem
Created November 24, 2016 09:24
Show Gist options
  • Save iworkforthem/feb1c3844b21a98b5a11cd3407784098 to your computer and use it in GitHub Desktop.
Save iworkforthem/feb1c3844b21a98b5a11cd3407784098 to your computer and use it in GitHub Desktop.
mongoose query events at specific date.
var today = req.body.today;
var runDate = (today == '' || today == null ? new Date() : new Date(today));
var tommorrow = new Date(runDate);
tommorrow.setDate(tommorrow.getDate() + 1);
console.log();
console.log('start '+dateFormat(runDate, "yyyy-mm-dd"));
console.log('end '+dateFormat(tommorrow, "yyyy-mm-dd"));
Event.find({
updateDate: {
$gte : runDate,
$lt : tommorrow
}
}, function(err, events) {
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment