Your challenge is to add a new Driver instance to an existing file with the connection details provided. Once you have created the Driver, you must open a new session and run a Cypher statement to find the director of Toy Story.
Steps
-
Install the Neo4j JavaScript Driver in the integrated terminal window
-
Use the
neo4j
object to create a new instance of the Driver with the credentials provided:-
NEO4J_URI
is the connection string -
NEO4J_USERNAME
andNEO4J_PASSWORD
should be used to create the authentication token.
-
-
Once you have created the Driver, open a new session and run the following query:
cypherFind the DirectorUnresolved directive in lesson.adoc - include::https://raw.githubusercontent.com/neo4j-graphacademy/llm-vectors-unstructured/main/cypher/movie-director.cypher[]
The statement requires the following parameters:
typescript{ title: 'Toy Story' }
-
To find the answer, click the Debug icon to the left of the window and run Create Driver Challenge task, or use the integrated terminal window to run the following command:
shRun The Challengets-node src/challenges/create-driver/challenge.ts
-
Once you have the result, copy and paste it into the text box below and click Check Answer.
View the Solution
Unresolved directive in lesson.adoc - include::https://raw.githubusercontent.com/neo4j-graphacademy/llm-vectors-unstructured/main/src/challenges/create-driver/solution.ts[]
Your Answer
Who directed Toy Story?
Take the Director value output from the statement above and paste it into the box below.
-
✓ John Lasseter
Hint
You need to call the neo4j.driver()
object to create a Driver instance using the NEO4J_URI
, NEO4J_USERNAME
and NEO4J_PASSWORD
variables, then open a new session, execute the Cypher statement and log the Director
value of the first record.
Your console.log()
statement should look similar to the code block below:
console.log(res.records[0].get('Director'))
Copy the answer without any quotes or whitespace.
Solution
John Lasseter directed Toy Story.
Compare your code with the solution here
Unresolved directive in questions/1-director.adoc - include::https://raw.githubusercontent.com/neo4j-graphacademy/llm-vectors-unstructured/main/src/challenges/create-driver/solution.ts[]
Lesson Summary
In this challenge, you used your knowledge to create a driver instance and run a Cypher statement.
In the next lesson, you will learn about the different transaction functions and when to use them.