I have a mongodb data such as below:
{
"program" : "DATE TRAINING",
"durationStart" : "2014-12-20",
"durationEnd" : "2014-12-20",
"status" : "Approved"
}
I'd like to count how many data is durationEnd date is less than today date. From the data above I know I have one.
Using nodejs I have tried with the below code but no luck so far. My console.log output for count is 0.
var today = new Date();
collection.count({
$or: [{
status: "Pending " + config.TD
}, {
status: "Approved",
durationEnd : {$lte : today }
}],
evaluationFlag: null
}, function(err, count) {
console.log("count is " + count);
}
});
nullduring the query, which most likely does not matchreq.user.username, hence the number of returned documents is 0.