Hi,
I have two documents which I can join using $lookup using field linkId. Once joined I needed to be able to join the netsed array from both documents on the id field of the items in the array. Is it possible to do this?
Document 1
{
_id:
{
"$oid": "64678a20d22348271c05f102"
},
taskPredictions: [
{
id: 2900868,
predictedCompletionStatus: "Early",
priority: 1,
},
{
id: 2900488,
predictedCompletionStatus: "OnTimeInFull",
priority: 4,
},
],
linkId:
{
"$oid": "64678a20d22348271c05f101"
},
}
Document 2
{
_id:
{
"$oid": "64678a27d22348271c05f10a"
},
tasks: [
{
id: 2900868,
name: "Task 1",
},
{
id: 2900488,
name: "Task 2",
},
],
"linkId":
{
"$oid": "64678a20d22348271c05f101"
}
}
the output I’m trying to achieve is like this
{
tasks: [
{
id: 2900868,
name: "Task 1",
predictedCompletionStatus: "Early",
priority: 1,
},
{
id: 2900488,
name: "Task 2",
predictedCompletionStatus: "OnTimeInFull",
priority: 4,
},
]
}
If someone could point me in the right direction I’d appreciate it.