Have seen that new Date()
will display the current date with time. But I need only date part.
new Date()
ISODate("2015-06-11T06:49:17.684Z")
I need only date part--> ISODate("2015-06-11T00:00:00.000Z")
Below is the sample data:
{
"_id": ObjectId("55743942789a9abe7f4af40e"),
"msisdn": "9xxxxxxxxx",
"act_date": ISODate("2014-09-16T00:00:00Z"),
"date": ISODate("2015-06-07T00:00:00Z"),
"recharge": {
"recharge_amt": 100,
"rechargetype": "WEB"
},
"voice": {
"local_og_mou": 4,
"local_other_mobile_og_mou": 18,
"nld_og_mou": 10,
"nld_other_mobile_og_mou": 3
},
"gprs_usage": {
"total_access_count": 1,
"total_datavolume_mb": 63
},
"sms": {
"freesms": 0,
"local_sms_count": 0,
"nat_sms_count": 2,
"inter_sms_count": 0
}
}
Need to Fetch current day data based on date field.
Is there any CURDATE()
function like in mysql for mongoDB?
Well you can "round" the date object to the current day:
Of course, there are varying language dependant ways to "round" your date, but this is a JavaScript way.