Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-17-2020 04:57 PM
Hello,
I'm using driver for Neo4j database with this code:
As you can see, I create query and then I might or might not create other nodes BASED on some conditions and collections.
Problem is that every time I have to match that first node again and again.
Is there some way I can temporally store the first node into some variable, so I dont have to search for that?
Solved! Go to Solution.
04-18-2020 01:11 PM
Your first statement could do a return id(n) as id
.
In your follow-up statements you'd use match (n) where id(n)=$i ....
and pass in {id: <id from 1st query>}
as a parameter. This does a simple lookup by id which is basically a seek operation - extremely fast.
Another idea would be to run all your stuff in one single statement, cypher has a foreach
/ unwind
.
04-18-2020 01:11 PM
Your first statement could do a return id(n) as id
.
In your follow-up statements you'd use match (n) where id(n)=$i ....
and pass in {id: <id from 1st query>}
as a parameter. This does a simple lookup by id which is basically a seek operation - extremely fast.
Another idea would be to run all your stuff in one single statement, cypher has a foreach
/ unwind
.
All the sessions of the conference are now available online