0
votes

I'm newbie to Neo4j/GraphDB and have created following simple graph

node[1]user1 which is 'friend' with node[2]user2 and node[3]user3 and all 3 above user have 'post' nodes connected to them as well..

question is how to get user1's connected friend and their post as well?

following query returns friends of user1 and his post only...

START user1=node(2) MATCH user1-->all_node RETURN all_node
1

1 Answers

1
votes

Depending on the relationship types you have chosen, something like this should work:

START user1=node(2) 
MATCH user1-[:FRIEND]->friend-[:POST]->post 
RETURN friend,post