Database

db={reports:[{report_id:1,name:"example report",hubId:4,dimensions:{region:"North america",country:"USA"},nameB:"Amsol Inc."},{report_id:2,name:"example report",hubId:4,dimensions:{region:"North america",country:"Canada"},nameB:"Amsol Inc."},{report_id:3,name:"example report",hubId:5,dimensions:{region:"North america",country:"USA",revenue:20000},nameB:"Microsoft Inc."},{report_id:4,name:"example report",hubId:4,dimensions:{region:"North america",country:"Greenland"},nameB:"Amsol Inc."},],company:[{company_id:1,hubId:4,dimensions:{region:"North america",country:"USA",distribution:"all","sub-distribution":"all"},name:"Amsol Inc."},{company_id:1,hubId:4,dimensions:{region:"North america",country:"Canada"},name:"Amsol Inc."},{company_id:2,hubId:7,dimensions:{region:"North america",country:"USA",revenue:34555},name:"Microsoft Inc."}]}

Query

db.reports.aggregate([{$lookup:{from:"company",let:{hubId:"$hubId",dimensions:"$dimensions"},as:"companies",pipeline:[{$match:{$expr:{$and:[{$eq:["$hubId","$$hubId"]},{$setEquals:[{$filter:{input:{$objectToArray:"$dimensions"},as:"compKey",cond:{$not:{$in:["$$compKey.k",["sub-distribution","distribution"]]}}}},{$objectToArray:"$$dimensions"}]}]}}},{$project:{_id:1}}]}},])

Result