I defined a request variable, but I can't seem to use it in the $in block:
{
$lookup: {
from: 'users',
as: 'user',
let: {
"blogIds": "$blog.id"
},
pipeline: [{
$project: {
id: 1,
user_name: 1,
picture: 1,
blogs: 1
},
},
{
$match: {
blogs: {
$in: ["$$blogIds"]
}
}
},
]
}
}
What could be causing this issue?
If I try sending without $match
, but with '$addFields':
{
$lookup: {
from: 'users',
as: 'user',
let: {
"blogIds": "$blog.id"
},
pipeline: [{
$project: {
id: 1,
user_name: 1,
picture: 1,
blogs: 1
},
},
{
$addFields: {
field: "$$blogIds"
}
},
]
}
}
https://i.sstatic.net/zMK8U.png
An example of the document:
https://i.sstatic.net/yOlEW.png
Lorem ipsum dolor amen.