Database

[{"collection":"candidates","count":10,"content":{"parentsId":{"type":"stringFromParts","parts":[{"type":"objectId"}]},"votes":{"type":"array","minlength":1,"maxLength":10,"arrayContent":{"type":"object","objectContent":{"voteId":{"type":"reference","id":1,"refContent":{"type":"stringFromParts","parts":[{"type":"objectId"}]}},"something":{"type":"int","min":1,"max":1000}}}}}},{"collection":"registration","count":100,"content":{"voteId":{"type":"ref","id":1},"name":{"type":"faker","method":"Name"}}}]

Query

db.candidates.aggregate([{"$lookup":{"from":"registration","localField":"votes.voteId","foreignField":"voteId","as":"voters"}},{"$set":{"votes":{"$map":{"input":"$votes","as":"vote","in":{"$mergeObjects":["$$vote",{"name":{"$getField":{"field":"name","input":{"$first":{"$filter":{"input":"$voters","as":"voter","cond":{"$eq":["$$vote.voteId","$$voter.voteId"]}}}}}}}]}}}}},{"$unset":"voters"}])

Result