db.getCollection("Issues").aggregate(
[
{
"$project": {
"zipdate" : {$month: "$zipfile.zip_file_dt_tm"},
}
},
{
$group: {
_id: "$zipdate" ,
totalPrice : { $sum: 1 }
}
}
]
);
If I run the above query. it is giving me the below error.
{
"message" : "can't convert from BSON type string to Date",
"ok" : 0,
"code" : 16006,
"codeName" : "Location16006",
"name" : "MongoError"
}
Here is collection details.
{
"_id" : ObjectId("5f68a350621f37798e5523f4"),
"issue_type" : "CH",
"zipfile" : [
{
"zip_file_dt_tm_utc" : "2019-08-08 12:08:52",
"zip_file_dt_tm" : "2019-08-08"
}
]
}