An exemple fo my data
{
"_id" : ObjectId("61cda8dabc3c3e648af34775"),
"icone" : [
"pomme",
"mangue"
],
"is_good" : true,
"date" : ISODate("2021-12-30T12:40:58.807Z")
},
{
"_id" : ObjectId("61cda8dabc3c3e648af34775"),
"icone" : [
"pomme",
"mangue"
],
"is_good" : false,
"date" : ISODate("2021-12-30T12:53:40.595Z")
}
Which query can I use to match by specific date and then group by date where "is_good" is true ?
The output that I'm expected is :
[{
"date" : ISODate("2021-12-30T12:53:40.595Z"),
"is_good" : true,
"count": 10,
"percent" : 23%
},
{
"date" : ISODate("2021-20-30T12:53:40.595Z"),
"is_good" : true,
"count": 10,
"percent" : 12%
}]