I need to find record by using aggregate query, and if any of given input is empty array then need to skip that query. In the below code, i have give one empty array to "brandFilter", then that query need to skip $in execution. If it has some array [one, two], then it will give related matched output
Example
{ $filter: {
input: '$products',
as: 'item',
cond: { $and: [
{
$gte: ['$$item.prodprice', Number(price)],
},
{ $in: [ "$$item.brand", brandArr ] }
]}
}}