Hello
Is it possible to group by 3 fields ( in my case name,company, function) ?
For now i can group only by name, this is the current output :
the aggregation :
group = {"$group": {"_id": "$name", "contacts": {"$push": "$$ROOT"}}}
Output;
{
"content": [
{
"_id": "Name Example 1",
"contacts": [
{
"source": "FANAF2018",
"name": "Name Example 1",
"mail": "FANAF@gmail.com",
"international": "International",
"function": "test_func1",
"company": "test_company1",
"_id": "EB1885A2CAB343788E8B8394C296441D"
},
{
"source": "DSH2329",
"name": "Name Example 1",
"mail": "DSH@gmail.com",
"international": "International",
"function": "test_func1",
"company": "test_company1",
"_id": "79212F41F98C44AF9C91CB482ED226F2"
}
]
},
...
}
This is what i want to acheive :
{
"content": [
{
"_id": "1234567",
"name": "Name Example 1",
"function": "test_func1",
"company": "test_company1",
"contacts": [
{
"source": "FANAF2018",
"mail": "FANAF@gmail.com",
"international": "International",
"_id": "EB1885A2CAB343788E8B8394C296441D"
},
{
"source": "DSH2329",
"mail": "DSH@gmail.com",
"international": "International",
"_id": "79212F41F98C44AF9C91CB482ED226F2"
}
]
},
...
}
Thank you