This code does not match the bu.subUser with subUser and due to mismatch nothing is returned. How to achieve the output?
{
$match: {
subUser: {
$ne: blockedUsers.map((bu) => {
return bu.subUser;
}),
},
},
}
{ $match: { subUser: { $nin: blockedUsers.map((bu) => bu.subUser) } } }