Skip to content
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

Open
wants to merge 6 commits into
base: 5.0
Choose a base branch
from
Open

Updates to the Readme File #1259

wants to merge 6 commits into from

Conversation

MaxAake
Copy link
Contributor

@MaxAake 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.

@MaxAake MaxAake changed the title Updates to the Readme FIle Updates to the Readme File Feb 19, 2025
```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', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.then(() => session.close())
.finally(() => session.close())

.catch(error => {
console.log(error)
})
.then(() => session.close())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.then(() => session.close())
.finally(() => session.close())

//
var executeQueryResultPromise = driver
.executeQuery(
"MATCH (alice:Person {name: $nameParam}) RETURN alice.DOB AS DateOfBirth",
Copy link
Member

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Driver instance should be closed when Node.js application exits:
Driver instance should be closed when the application exits:
  1. needs an article
  2. 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({
Copy link
Member

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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.then(() => session.close())
.then(() => driver.close())

There is no session here

nameParam: 'Bob'
})
)
.records()
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants