How to lookup with object by reference id and other properties.
collectionA
{
_id: ObjectId("6013859ba0c3120034d08bfa"),
name: "A1",
refs:[
{id: ObjectId("6013859ba0c3120034d08bfb"), text: "ABC"},
{id: ObjectId("6013859ba0c3120034d08bfc"), text: "DEF"}
]
}
collectionB
{
_id: ObjectId("6013859ba0c3120034d08bfb"),
name: "B1"
}
{
_id: ObjectId("6013859ba0c3120034d08bfc"),
name: "B2"
}
Expected Result
{
_id: ObjectId("6013859ba0c3120034d08bfa"),
name: 'A1',
refs:[
{id: ObjectId("6013859ba0c3120034d08bfb"), name: "B1", text: "ABC"},
{id: ObjectId("6013859ba0c3120034d08bfc"), name: "B2", text: "DEF"}
]
}