Hi all, I am trying to make a chart but when I query between two collections, as you can see all the row of local collection match with the first row in "from"- "Campaign" collection.
This is my following code:
[
{
"$lookup":
{
"from": "Campaign",
"localField": "Conversion.campaign_id",
"foreignField": "Campaign.campaign_id",
"as":"as1"
}
},
{
"$replaceRoot": { "newRoot": { "$mergeObjects": [ { "$arrayElemAt": [ "$as1", 0 ] }, "$$ROOT" ] } }
},
{ "$project": { "as1": 0 } }]
Can anyone help me this questions?