Database
[{/** PARENT ENTITY*/"_id":"123",/** the local key*/"title":"initialentity"},{/** CHILD ENTITY*/"_id":"456","title":"relatedentity","rels":[{"r":"123",/** the foreign key*/"a":"exampledata-ignorethisfield",},]}]
Query
db.collection.aggregate([{"$lookup":{"from":"collection","let":{"id":{$toString:"$_id"}},"pipeline":[{"$match":{$expr:{"$in":["$$id",{"$ifNull":["$rels.r",[]]}]}}},{$limit:1}],"as":"result"}},{$limit:1}])