Database

[{"collection":"collection","count":100,"content":{"_id":{"type":"autoincrement","autoType":"int","startInt":0},"refs":{"type":"array","minLength":0,"maxlength":3,"arrayContent":{"type":"enum","values":[1,2,3]},"nullPercentage":20}}}]

Query

db.collection.aggregate([{"$unwind":"$refs"},{"$group":{"_id":null,"refs":{"$addToSet":"$refs"}}},{"$lookup":{"from":"collection","localField":"refs","foreignField":"_id","as":"docs"}},{"$unwind":"$docs"},{"$replaceWith":"$docs"}])

Result