Database
db={"shop":[{"shop":"Q4","batch":"5647",},{"shop":"Q4","batch":"2314",}],"inventory":[{"bolt":"5647",},{"bolt":"0001",},{"bolt":"0004",}]}
Query
db.shop.aggregate([{$group:{_id:"$shop",batch:{$push:"$batch"}}},{$lookup:{from:"inventory",let:{batch:"$batch"},pipeline:[{$match:{$expr:{$in:["$bolt","$$batch"]}}}],as:"bolt"}},{$project:{_id:1,batch:1,bolt:{$reduce:{input:"$bolt",initialValue:[],in:{$concatArrays:["$$value",["$$this.bolt"]]}}}}}])