Skip to content

Instantly share code, notes, and snippets.

@crittermike
Last active September 3, 2020 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crittermike/9561693a60424c82dcc4765cb5492779 to your computer and use it in GitHub Desktop.
Save crittermike/9561693a60424c82dcc4765cb5492779 to your computer and use it in GitHub Desktop.
Parse and import a JS array into neo4j via the neo4j-driver
const session = driver.session()
const query = `WITH $data AS values
UNWIND values AS item
MERGE (thing:Thing {id: item.id})
SET thing.title = item.title`
session
.run(query, { data: yourArrayHere })
.catch((error) => {
console.error("Error syncing data: ", error)
})
.then(() => {
session.close()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment