Your challenge is to modify another pre-written file to add yourself as an actor in The Matrix.
Steps
-
Update the
params
object to use your name. This step isn’t strictly required, just a bit of fun. -
The Cypher statement is already written for you. Use the
neo4j.ExecuteRead()
method, passing thectx
andsession
variables, and a callback function to represent the unit of transactional work. -
In that function you must call the
Run()
method on the first parameter passed to the query, using thecypher
andparams
variables. -
await
the results and usefmt.Println()
to check that the code has executed correctly. -
To add the new node and relationship to the database, click the Debug icon to the left of the window and run Writing Data Challenge task, or use the integrated terminal window to run the following command:
shRun The Challengego run pkg/challenges/write/challenge.go
-
Once the code has run, click Verify and we will check that the node has been added to the database.
Verifying the Test
Once you have executed the code, click the Verify button and we will check that the code has been executed successfully.
Hint
To pass this challenge you must run the Cypher statement in a write transaction using the neo4j.ExecuteWrite()
or session.ExecuteWrite()
methods.
Solution
Compare your code with the solution here
Unresolved directive in questions/verify.adoc - include::https://raw.githubusercontent.com/neo4j-graphacademy/llm-vectors-unstructured/main/pkg/challenges/write/solution/solution.go[]
Lesson Summary
In this challenge, you used your knowledge to create a driver instance and execute a Cypher statement.
You should now have everything you need to use the Neo4j Go Driver in your next Go project.