After aggregations i get this result,
{
"_id" : {
"date" : ISODate("2017-08-30T00:00:00.000Z")
},
"aggr" : [
{
"gender" : "unknown",
"count" : 365
},
{
"gender" : "male",
"count" : 2
}
]
}
Is it possible to convert this into below format
{
"date" : ISODate("2017-08-30T00:00:00.000Z"),
"unknown" : 365,
"male" : 2
}
Tried using $unwind and $project, but couldn't convert array objects into key,value pairs