My first collection, called Scenes looks like this:
{
sceneId: "id1",
contentId: "contentId1",
comments: [{
comment: "abc",
userId: "test1"
},
{
comment: "def",
userId: "test2"
}]
},
{
sceneId: "id2",
contentId: "contentId2",
comments: [{
comment: "abc",
userId: "test1"
},
{
comment: "def",
userId: "test2"
}]
}
Any my second collection, called Userdatas, looks like this:
{
userId: "test1",
profilPicture: "def.jpg"
},
{
userId: "test2",
profilPicture: "abc.jpg"
}
And I want to join them in a way, that I get the following:
{
sceneId: "id1",
contentId: "contentId1",
comments: [{
comment: "abc",
userId: "test1",
profilPicture: "def.jpg"
},
{
comment: "def",
userId: "test2",
profilPicture: "abc.jpg"
}]
},
{
sceneId: "id2",
contentId: "contentId2",
comments: [{
comment: "abc",
userId: "test1",
profilPicture: "def.jpg"
},
{
comment: "def",
userId: "test2",
profilPicture: "abc.jpg"
}]
}
and I have no idea how to do this, all my previous attempts failed. Help is appreciated! The key problem is, that the $group operator will not show the contentId, when grouping via the sceneId