Database

db={"users":[{"userId":"Alice","username":"Alice","friends":["Bob"]},{"userId":"Bob","username":"Bob","friends":["Alice"]},{"userId":"Charlie","username":"Charlie","friends":["Alice","Dorothy"]},{"userId":"Dorothy","username":"Dorothy","friends":["Charlie"]}]}

Query

db.users.aggregate([{$match:{"userId":"Charlie"}},{"$unwind":"$friends"},{"$lookup":{"from":"users","localField":"friends","foreignField":"username","as":"foundFriend"}},{"$unwind":"$foundFriend"},{$group:{_id:null,friendsObjArr:{"$addToSet":"$foundFriend"}}}])

Result