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…