Database
db={"ROOT":[{"_id":1,"type":"customer","name":"anton"}],"A":[{"_id":33,"customer":1,"type":"order","address":"azores island"}],"B":[{"_id":"1_33_1","type":"item","name":"golf ball"},{"_id":"1_33_2","type":"item","name":"golf club"},{"_id":"2_33_1","type":"item","name":"golf ball"}]}
Query
db.ROOT.aggregate([{"$lookup":{"from":"A","localField":"_id","foreignField":"customer","as":"orders",pipeline:[{"$lookup":{"from":"B",let:{regex:{"$concat":["^",{$toString:"$customer"},"_",{"$toString":"$_id"}]}},pipeline:[{$match:{$expr:{$regexMatch:{input:"$_id",regex:"$$regex"}}}}],"as":"items"}}]}}])