Database
db={"friendshipsView":[{"_id":ObjectId("5a934e000102030405000000"),"areFriends":true,"user1":"A","user2":"B"},{"_id":ObjectId("5a934e000102030405000001"),"areFriends":true,"user1":"B","user2":"C"}]}
Query
db.friendshipsView.aggregate([{"$match":{"user1":"A"}},{"$graphLookup":{"from":"friendshipsView","startWith":"$user1","connectFromField":"user2","connectToField":"user1","as":"friendshipsViewLookup","depthField":"degree"}},{"$unwind":"$friendshipsViewLookup"},{"$match":{"friendshipsViewLookup.user2":"C"}},{"$project":{user1:1,user2:"$friendshipsViewLookup.user2",degree:{"$add":["$friendshipsViewLookup.degree",1]}}}])