For anyone else seeking a solution with a similar challenge - here is how I eventually managed to achieve the desired result:
{
"settings.tokenList": { $exists: true, $ne: null },
"primaryToken": { $exists: true, $ne: null },
$expr: {
$anyElementTrue: {
$map: {
input: "$settings.tokenList",
as: "token",
in: {
$and: [
{ $eq: ["$$token.number", "$primaryToken"] },
{ $eq: ["$$token.status", "INACTIVE"] }
]
}
}
}
}
}