Database

[{"userid":1,"following":[2,3],"salary":1000,"age":19},{"userid":2,"following":[],"salary":2000,"age":25},{"userid":3,"following":[2],"salary":1500,"age":20},]

Query

db.collection.aggregate([{$graphLookup:{from:"collection",startWith:"$following",connectFromField:"following",connectToField:"userid",as:"following",maxDepth:0}},{$project:{"_id":0,"userid":1,"following.salary":1,"following.userid":1}}])

Result