I'm executing the below query in neo4j which returns me all the nodes along with its relationship paths
Query
MATCH (p:MyNode {name : "Vivek"})-[r*1..2]->(f:MyNode) return p,[x in r | type(x)] as rel,f
Result
{vivek} ["knows"] {Rajesh}
{vivek} ["knows","friendof] {Ezhil}
While this query executes right and gives me expected results i get the below warning in the neo4j browser
Binding relationships to a list in a variable length pattern is deprecated. (Binding a variable length relationship pattern to a variable ('r') is deprecated and will be unsupported in a future version. The recommended way is to bind the whole path to a variable, then extract the relationships: MATCH p = (...)-[...]-(...) WITH *, relationships(p) AS r)
Just to upgrade my query i've tried variety of ways but nothing helped. Looking for help on this aspect.
Here is a matching combination i've tried as suggested in the help
MATCH p1 = (p:MyNode {name : "Vivek"})-[r*1..2]-(f:MyNode) WITH *, relationships(p1) AS r return p1
Result
Multiple result columns with the same name are not supported (line 1, column 60 (offset: 59)) "MATCH p1 = (p:MyNode {name : "Vivek"})-[r*1..2]-(f:MyNode) WITH *, relationships(p1) AS r return p1"
Update
when you did * in the second line, you are taking all the columns generated in first list and they are p1,p,r,f . That is why you cannot alias relationships(p1) as r again. To get the results as in query-1. you can do like this-