![]()
Hi @Helene_ORTIZ, and welcome to the community forums.
To group on multiple fields in an aggregation, you would make the _id field an object like the following:
{
$group: {
"_id": {
ctype: "$ctype",
cname: "$cname",
pname: "$pname"
},
...
}
}
this will give you a grouping for each unique combination of values in those three fields.
Without seeing the data, query and results it’s hard to say why you only got a single value back if you have three unique values in the dataset for ctype.