diff --git a/examples/with-neo4j/package.json b/examples/with-neo4j/package.json
index bd9247729d261..cfdf0fce299e5 100644
--- a/examples/with-neo4j/package.json
+++ b/examples/with-neo4j/package.json
@@ -6,7 +6,7 @@
"start": "next start"
},
"dependencies": {
- "neo4j-driver": "4.1.1",
+ "neo4j-driver": "^4.3.1",
"next": "latest",
"react": "^17.0.2",
"react-dom": "^17.0.2",
diff --git a/examples/with-neo4j/pages/actor/[name].js b/examples/with-neo4j/pages/actor/[name].js
index 67d07d03d3c9c..a12adfacb4581 100644
--- a/examples/with-neo4j/pages/actor/[name].js
+++ b/examples/with-neo4j/pages/actor/[name].js
@@ -29,7 +29,7 @@ export default function Actor() {
diff --git a/examples/with-neo4j/pages/api/actors/[name].js b/examples/with-neo4j/pages/api/actors/[name].js
index b81117ba400a0..e1fda7db270a8 100644
--- a/examples/with-neo4j/pages/api/actors/[name].js
+++ b/examples/with-neo4j/pages/api/actors/[name].js
@@ -17,9 +17,9 @@ export default async function handler(req, res) {
async (transaction) => {
const cypher = `
MATCH (actor:Person {name: $actorName})
- MATCH (m:Movie)
- WHERE (actor)-[:ACTED_IN]->(m)
- RETURN actor {.*, movies: collect(m.title)} as actor
+ RETURN actor {.*,
+ movies: [ (actor)-[:ACTED_IN]->(m) | m.title ]
+ } as actor
`
const actorTxResponse = await transaction.run(cypher, { actorName })
diff --git a/examples/with-neo4j/pages/api/movies/[title].js b/examples/with-neo4j/pages/api/movies/[title].js
index a106fc21b56bc..77551dc14dc86 100644
--- a/examples/with-neo4j/pages/api/movies/[title].js
+++ b/examples/with-neo4j/pages/api/movies/[title].js
@@ -17,11 +17,10 @@ export default async function handler(req, res) {
async (transaction) => {
const cypher = `
MATCH (movie:Movie {title: $movieTitle})
- MATCH (actor:Person)
- WHERE (movie)<-[:ACTED_IN]-(actor)
- MATCH (director:Person)
- WHERE (movie)<-[:DIRECTED]-(director)
- RETURN movie {.*, actors: collect(DISTINCT actor.name), directed: collect(DISTINCT director.name)} as movie
+ RETURN movie {.*,
+ actors: [ (actor)-[:ACTED_IN]->(movie) | actor.name ],
+ directed: [ (director)-[:DIRECTED]->(movie) | director.name ]
+ } as movie
`
const movieTxResponse = await transaction.run(cypher, {
diff --git a/examples/with-neo4j/pages/api/movies/index.js b/examples/with-neo4j/pages/api/movies/index.js
index 2d95156b4d6a2..4223894f15e5f 100644
--- a/examples/with-neo4j/pages/api/movies/index.js
+++ b/examples/with-neo4j/pages/api/movies/index.js
@@ -13,11 +13,11 @@ export default async function handler(req, res) {
async (transaction) => {
const cypher = `
MATCH (movie:Movie)
- MATCH (actor:Person)
- WHERE (movie)<-[:ACTED_IN]-(actor)
- MATCH (director:Person)
- WHERE (movie)<-[:DIRECTED]-(director)
- RETURN movie {.*, actors: collect(DISTINCT actor.name), directed: collect(DISTINCT director.name)} as movie
+ RETURN movie {.*,
+ actors: [ (movie)<-[:ACTED_IN]-(actor) | actor.name ],
+ directed: [ (movie)<-[:DIRECTED]-(director) | director.name ]
+ } as movie
+ ORDER BY movie.title ASC
`
const moviesTxResponse = await transaction.run(cypher)
diff --git a/examples/with-neo4j/pages/index.js b/examples/with-neo4j/pages/index.js
index 99f6a4c5f82bf..086833823e68a 100644
--- a/examples/with-neo4j/pages/index.js
+++ b/examples/with-neo4j/pages/index.js
@@ -42,16 +42,11 @@ export default function Home() {
{index + 1} |
-
+
{movie.title}
|
- {movie.released.low} |
+ {movie.released} |
{movie.tagline} |
@@ -64,12 +59,7 @@ export default function Home() {
{movie.actors.map((actor) => (
-
-
+
{actor}
diff --git a/examples/with-neo4j/pages/movie/[title].js b/examples/with-neo4j/pages/movie/[title].js
index 8fd85b55ff85d..dd12fee05c1d3 100644
--- a/examples/with-neo4j/pages/movie/[title].js
+++ b/examples/with-neo4j/pages/movie/[title].js
@@ -33,13 +33,17 @@ export default function Movie() {
Released:
- {data.movie.released.low}
+ {data.movie.released}
Actors
{data.movie.actors.map((actor) => (
- {actor}
+
))}
@@ -81,6 +85,9 @@ export default function Movie() {
.movie {
margin-bottom: 2rem;
}
+ .movie a {
+ text-decoration: underline;
+ }
.back {
padding: 1rem 0;
}
diff --git a/examples/with-neo4j/util/neo4j.js b/examples/with-neo4j/util/neo4j.js
index 18ad7163fec5a..781f12a411074 100644
--- a/examples/with-neo4j/util/neo4j.js
+++ b/examples/with-neo4j/util/neo4j.js
@@ -11,7 +11,12 @@ const defaultOptions = {
export default function getDriver() {
const { uri, username, password } = defaultOptions
if (!driver) {
- driver = neo4j.driver(uri, neo4j.auth.basic(username, password))
+ // Note: There is a disparity between Neo4j (Java) Integers and JavaScript integers
+ // I have used `disableLosslessIntegers` to remove the need to call `.toNumber()` on each integer value
+ // For more info see: https://github.com/neo4j/neo4j-javascript-driver/#numbers-and-the-integer-type
+ driver = neo4j.driver(uri, neo4j.auth.basic(username, password), {
+ disableLosslessIntegers: true,
+ })
}
return driver
|