cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Deprecated query

rangan
Node

My query that I had for sometime seems to be deprecated (it works though but eventually might not) and want to know how I can get the same output with the right query. Here is my query

MATCH (root:Person {lns_neo4j_id:'9'})-[lns_relationship*1..3]->(a:Person) UNWIND lns_relationship AS rs RETURN DISTINCT startNode(rs) as Person, rs as Relationship, endNode(rs) as RelatedPerson Order by startNode(rs).lns_neo4j_id

Any suggestions please.

4 REPLIES 4

Hello @rangan and welcome to the Community!

What version of Neo4j database are you using?

What is the content of the deprecation warning that you are seeing?

Elaine

rangan
Node

Hi @elaine.rosenberg

The version is 4.2 and the error/warning is as follows:

Binding relationships to a list in a variable length pattern is deprecated.
(Binding a variable length relationship pattern to a variable ('lns_relationship') is deprecated
and will be unsupported in a future version. Appreciate your feedback

Thanks
Bye

Here is what engineering recommends:

Use relationships() function on a path - MATCH - Neo4j Cypher Manual

Elaine

dksingh1
Node

@rangan You can use the apoc.convert.toTree to get the associated nodes. Below is the link which might help you.

Thanks