Hello
My collection have file 50 000 000 and i try to do this aggregate but
I would like optimising my aggregate because Mongodb can’t run it
One file :
"_id" : ObjectId("63ecb0ba9726636b1ffc7611"),
"Ippr" : "54203",
"DateDerniereInteraction" : ISODate("2019-07-09T11:21:16.043+0000"),
"IdTechPs" : "01d63ab8ab054b8fbf45203a0b2279"
The aggregate :
db.InteractionPatient.aggregate(
[
// On considère unique les dates d'interaction plus grand que
{
$match: {DateDerniereInteraction:{$gte:ISODate("2020-01-01T13:21:32.692+0000")}}
},
//On compte le nombre d'intéraction par IPPR
{
$group :
{
_id : "$Ippr",
NBinteraction: {$sum:1}
}
},
// On ne compte que les IPPR ayant au moins un certain nombre d'intéraction
{
$match: { "NBinteraction": { $gte: 3 } }
},
{
// On groupe par nombre d'intéraction
$group :
{
_id : "$NBinteraction",
Nb_patient: {$sum:1}
}
}
]
)