Consider I have collection 2 collections named a, b.
collection a
{
"id":"123"
"key1":"fjf",
"key2":[{},{}]
}
collectionB
{
"key1b":"fjf",
"id":"123",
"key2b":"bvbvb"
}
Expected output:
{
"id":"123"
"key1":"fjf",
"key2":[{},{}],
"joined":[{
"key1b":"fjf",
"id":"123",
"key2b":"bvbvb"
}]
}
So have to join the 2 collections based on condition a.key1 == b.key1b&&a.id == b.id
. SO i have used the pipepline stage as follows:
await a.aggregate([
{ "$match": { "x": "fdsfd" } },
{
"$lookup": {
"from": "b",
"let": { "Id": "$id" },
"pipeline": [
{
"$match": {
"$expr": {
"$and": [
{ $eq: ["$id", "$$qId"] },
{
$eq: ["$key1b", "adsdsd"],
},
],
},
}
}
],
"as": "abc"
}
}
])
Its works fine in mongoDb. But $let is not supported in DocDB as per AWS doc. So how can i rewrite the query the above query without $let?
Tried the following:
etc. But noting helps.