db.getCollection('posts').aggregate([
{ $match: {"title": "some" } },
{ $unwind: "$comments" },
{ $group: {
'_id': {
'year': { '$year': "$comments.createdDate" },
'month': { '$month': "$comments.createdDate" },
'day': { '$dayOfMonth': "$comments.createdDate" },
'post_id': {$first: "$_id"}
},
post_title: {$first: "$title"},
post_body: {$first: "$body"},
post_comments: { $addToSet : "$comments" }
}},
])