I have two collections 1 is campaigns and other is orders. I have to filter orders for each campaign. So what I am doing is that I'm fetching all the campaigns and after that I'm looking up for the orders that matches some specific criteria.
[
{
$match: { type: 'FOLLOWUP' }
},
{
$lookup: {
from: 'orders',
as: 'orders',
pipeline: [
{
$match: {
'status': { $in: '$activeFilter' }
}
}
]
}
}
]
In above example status contain some specific string and the activeFilter has array of string containing active status for that campaign. activeFilter is an array but I'm getting error that $in needs an array.
Any help would be appreciated.