Join collections

Hello, I am a beginner in mongodb, I have the following problem:
I want to join two collections as follows:

collection 1:

product

{
 "_id" : ObjectId("6399260eaa30a55748d5d"),
 "name": "name product",
 "size": "size",
"sku" : [
        {
            "ean" : "100",
            "sku" : "12"
        },
        {
            "ean" : "101",
            "sku" : "13"
        }
    ]
    ...
}

collection 2:

properties:

{
    "_id" : ObjectId("63756659ee48ff285373939c"),
    "sku" : "12", 
    "ff" : 11,
    **"id_product" : ObjectId("6399260eaa30a55748d5d")   ---> _id from collection 1**
}
{
    "_id" : ObjectId("63756659ee48ff28537393op"),
    "sku" : "13",
    "ff" : 12,
    **"id_product" : ObjectId("6399260eaa30a55748d5d")  _id from collection 1**
}

data expected after join:

{

all the data of the collection 1
.
.
.
"sku": [
	{
            "ean" : "100",
            "sku" : "12",
            **"ff"  : 11, ---> field from collections 2**
        },
        {
            "ean" : "101",
            "sku" : "13",
            **"ff"  : 12  ---> field from collections 2**
        }
]

}

Thanks for the suggestions…

Hello @Ruben_Quiroz ,

Welcome to The MongoDB Community Forums! :wave:

Instead of Join, MongoDB has $lookup, it performs a left outer join to a collection in the same database to filter in documents from the “joined” collection for processing. The $lookup stage adds a new array field to each input document. The new array field contains the matching documents from the “joined” collection.

Let us know in case you need more help or have any other queries, I’ll be happy to help you!

Regards,
Tarun

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.