Database

db={mycollection:[{"_id":"1","value":"value_of_1","sharedWith":["2"]},{"_id":"2","value":"value_of_2","sharedWith":[]}]}

Query

db.mycollection.aggregate([{$match:{_id:"2"}},{"$lookup":{"from":"mycollection","localField":"_id","foreignField":"sharedWith","as":"sharedItems"}}])

Result