Last active
September 3, 2020 18:23
-
-
Save crittermike/9561693a60424c82dcc4765cb5492779 to your computer and use it in GitHub Desktop.
Parse and import a JS array into neo4j via the neo4j-driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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