I have the below mongo DB schema:
{
"_id" : "5b76c3c037548390fdb5b40e",
"userId" : "4601",
"modified" : ISODate("2018-08-21T19:13:43.301+05:30"),
"rStatus" : "started",
},
{
"_id" : "5b76c3c037548390fdb5b40e",
"userId" : "13",
"modified" : ISODate("2018-08-21T19:13:43.301+05:30"),
"rStatus" : "completed",
},
........
There is a need to get data group by modified date and count of rStatus field, eg
{
modified:"2018-08-21",
count :{"completed":1,"ongoing":4}
},
{
modified:"2018-07-23",
count :{"completed":2,"ongoing":5}
},
I am using $group but its count by modified date only not by the inner keys' values.