cypher - Neo4j Optional match not working on 2.2.1 -
i have users data like
id username --------------------------- 1 user1 2 user2 3 user3 4 user4 5 user5
there can friends
relation between users. suppose user1
need list of user friends count , mutual frends count
in database
user2
have 2 friendsuser3, user4
.user4
friend ofuser3
i have tried this
match (me:user {is_deleted:false}) id(me)= 1 match (alluser:user {is_deleted:false}) optional match (alluser)<-[all_friends:friends]-(f:user {is_deleted:false}) optional match (me)-[mutual_friends:friends]->(f) return id(alluser) user_id, alluser.username username, count(distinct(all_friends)), count(distinct(mutual_friends))
it provide me count of all_friend
correct.
but not getting mutual_friends
count return 0 if there realtions.
note:-this query works fine on neo4j 2.1
not working on neo4j 2.2
.
what should in query make working.
please let me know if should explain more quetion.
thanks.
Comments
Post a Comment