Need help with aggregate 2 collections

Hi all,

I am trying to use Metabase, but I got some problems when I want to join 2 collections.

    [{
       "$lookup":
        {
           "from": "Campaign",
           "localField": "Conversion.campaign_id",
           "foreignField": "Campaign.campaign_id",
           "as":"as1"
        }
     },
     {
          "$unwind":"$as1"
       },

     {
        "$project":
        {
            "campaign_id":"$as1.campaign_id", 
            "campaign_name":"$as1.campaign_name"
        }
         
    }]

This above one shows me that:


You can see _id will be matched with all of each name and that’s not what I want: I just want an _id matches with only one campaign_name

So then, I try this code:

[{
   "$lookup":
    {
       "from": "Campaign",
       "localField": "Conversion.campaign_code",
       "foreignField": "Campaign.campaign_code",
       "as":"as1"
    }
 },
 {
      "$replaceRoot": { "newRoot": { "$mergeObjects": [ { "$arrayElemAt": { "as1", 0 } }, "$$ROOT" ] } }
   },
   
 {
      "$unwind":"$as1"
   },
   {
    "$project":
    {
        "campaign_id":"$as1.campaign_id", 
        "campaign_name":"$as1.campaign_name"
    }}
     
]

and then got the error:


Can anyone help me?
Thank you for reading carefully