You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: asciidoc/courses/app-typescript/modules/1-driver/lessons/5-c-writing-data/lesson.adoc
+65-1Lines changed: 65 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,19 +49,83 @@ Run the file using `ts-node` to view the result:
49
49
ts-node {lab-file}
50
50
----
51
51
52
-
You can check the result in the Neo4j Browser by running the following query:
52
+
If successful, you should see output similar to the following (with your name instead of "Your Name"):
53
+
54
+
.Expected Output
55
+
[source,json,role=nocopy]
56
+
----
57
+
{
58
+
identity: Integer { low: 12345, high: 0 },
59
+
labels: [ 'Person' ],
60
+
properties: { name: 'Your Name' },
61
+
elementId: '4:abc123:12345'
62
+
}
63
+
----
64
+
65
+
You can also verify the result in the Neo4j Browser by running the following query:
53
66
54
67
[source, cypher]
55
68
----
56
69
MATCH (m:Movie {title: "Matrix, The"})<-[a:ACTED_IN]-(p:Person)
57
70
RETURN m, a, p
58
71
----
59
72
73
+
You should see your `Person` node connected to _The Matrix_ movie.
74
+
75
+
60
76
include::questions/verify.adoc[leveloffset=+1]
61
77
78
+
79
+
== Troubleshooting
80
+
81
+
.ts-node: command not found
82
+
[%collapsible]
83
+
====
84
+
If you receive a `ts-node: command not found` error, you can either:
85
+
86
+
1. Install `ts-node` globally:
87
+
+
88
+
[source,sh]
89
+
----
90
+
npm install -g ts-node
91
+
----
92
+
93
+
2. Or run via npx:
94
+
+
95
+
[source,sh,subs=attributes+]
96
+
----
97
+
npx ts-node {lab-file}
98
+
----
99
+
====
100
+
101
+
.Cannot use import statement outside a module
102
+
[%collapsible]
103
+
====
104
+
This error occurs when Node.js tries to run TypeScript/ES modules as CommonJS.
105
+
Ensure your `tsconfig.json` has the correct module settings, or run with:
106
+
107
+
[source,sh,subs=attributes+]
108
+
----
109
+
npx ts-node --esm {lab-file}
110
+
----
111
+
====
112
+
113
+
.Verification fails but code works
114
+
[%collapsible]
115
+
====
116
+
If your code runs successfully and creates the node (you can see it in Neo4j Browser) but the verification fails:
117
+
118
+
1. Ensure you are using the sandbox provided by GraphAcademy (not a local database)
119
+
2. Check that the Person node was created with an `ACTED_IN` relationship to the movie titled "Matrix, The"
120
+
3. Try refreshing the page and clicking Verify again
121
+
====
122
+
123
+
62
124
[.summary]
63
125
== Lesson Summary
64
126
65
127
In this challenge, you used your knowledge to create a driver instance and run a Cypher statement.
66
128
67
129
Next, we will look at the Neo4j Type System and some of the considerations that you need to make when working with values coming from Neo4j in your TypeScript application.
0 commit comments