1

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%

}]
1
  • Welcome to DBA.SE You will have much better luck if you provide examples of what you've tried thus far, plus examples of what your output should look like. Feb 3 at 0:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.