Database
db={"users":[{user:"foo",urls:["/url1","/url2","/url3"]}],"menu":[{name:"bar",link:"/url1234",component:"layout"},{name:"baz",link:"/url454",component:"layout"}]}
Query
db.users.aggregate([{$match:{user:"foo"}},{$unwind:"$urls"},{"$lookup":{"from":"menu","let":{url:"$urls"},"pipeline":[{"$match":{$expr:{$and:[{$eq:["$component","layout"]},{$ne:[-1,{"$indexOfCP":["$link","$$url"]}]}]}}}],"as":"menuLookup"}},{"$unwind":"$menuLookup"},{"$replaceRoot":{"newRoot":"$menuLookup"}},{"$unset":"component"}])