-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to the Readme File #1259
base: 5.0
Are you sure you want to change the base?
Conversation
MaxAake
commented
Feb 18, 2025
- Replaces session.run() with driver.executeQuery() as the default function on example code.
- Adds explanations of session.run() and driver.executeQuery()
- Adds ES6 import syntax.
```javascript | ||
// Run a Cypher statement, reading the result in a streaming manner as records arrive: | ||
driver | ||
.executeQuery('MERGE (alice:Person {name : $nameParam}) RETURN alice.name AS name', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.executeQuery('MERGE (alice:Person {name : $nameParam}) RETURN alice.name AS name', { | |
.executeQuery('MERGE (alice:Person {name: $nameParam}) RETURN alice.name AS name', { |
.catch(error => { | ||
console.log(error) | ||
}) | ||
.then(() => session.close()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.then(() => session.close()) | |
.finally(() => session.close()) |
.catch(error => { | ||
console.log(error) | ||
}) | ||
.then(() => session.close()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.then(() => session.close()) | |
.finally(() => session.close()) |
// | ||
var executeQueryResultPromise = driver | ||
.executeQuery( | ||
"MATCH (alice:Person {name: $nameParam}) RETURN alice.DOB AS DateOfBirth", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was the attribute change (but only for this query)? (Not a blocker)
var neo4j = require('neo4j-driver') | ||
// Alternatively, if you are using ES6 | ||
import neo4j from 'neo4j-driver' | ||
``` | ||
|
||
Driver instance should be closed when Node.js application exits: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Driver instance should be closed when Node.js application exits: | |
Driver instance should be closed when the application exits: |
- needs an article
- we're not only supporting Node.js nor does this advice only apply to Node
.executeQuery('MERGE (alice:Person {name : $nameParam}) RETURN alice.name AS name', { | ||
nameParam: 'Alice' | ||
}) | ||
.subscribe({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: driver.executeQuery(...).subscribe is not a function
.catch(error => { | ||
console.log(error) | ||
}) | ||
.then(() => session.close()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.then(() => session.close()) | |
.then(() => driver.close()) |
There is no session here
nameParam: 'Bob' | ||
}) | ||
) | ||
.records() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: rxSession.executeRead(...).records is not a function