neo4j / docs-drivers Goto Github PK
View Code? Open in Web Editor NEWNeo4j Drivers Documentation
License: Other
Neo4j Drivers Documentation
License: Other
this line is missing a comma at the end
Its not true that this is valid, you have to put the field name in ["fieldname"]
example:
for record in records:
print(record["fieldname"])
# works
for record in records:
print(record.fieldname)
# doesnt work
I am trying to use neo4j driver in my typescript project and while trying query from documentation here, I encountered below mentioned syntax error.
Details
Neo4j version: neo4j:4.0
(Docker Compose)
Neo4j Driver npm version: 5.14.0
Sample code
import neo4j from "neo4j-driver";
import dotenv from "dotenv";
dotenv.config();
const driver = neo4j.driver(
"bolt://localhost",
neo4j.auth.basic(process.env.NEO4J_USER ?? "", process.env.NEO4J_PASS ?? "")
);
export async function getDriver() {
const info = await driver.getServerInfo();
console.log("Connected to Neo4j");
console.log(info);
return driver;
}
(async () => {
const driver = await getDriver();
const { summary } = await driver.executeQuery(
`
MATCH (p:Person WHERE p.name = $name)
SET p.age = $age
`,
{ name: "Alice", age: 42 }
);
console.log("Query counters:");
console.log(summary.counters.updates());
})();
Error
> [email protected] dev /app/server
> ts-node app.ts
Connected to Neo4j
ServerInfo {
address: 'localhost:7687',
agent: 'Neo4j/4.0.12',
protocolVersion: 3
}
/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/result.js:613
var error = new Error('');
^
Neo4jError: Invalid input 'W': expected whitespace, comment, NodeLabel, MapLiteral, a parameter, a parameter (old syntax), ')' or a relationship pattern (line 2, column 17 (offset: 19))
" MATCH (p:Person WHERE p.name = $name)"
^
at captureStacktrace (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/result.js:613:17)
at new Result (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/result.js:105:23)
at newCompletedResult (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/transaction.js:520:12)
at Object.run (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/transaction.js:352:20)
at TransactionPromise.Transaction.run (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/transaction.js:183:34)
at ManagedTransaction.run (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/transaction-managed.js:56:21)
at QueryExecutor.<anonymous> (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/internal/query-executor.js:87:57)
at step (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/internal/query-executor.js:51:23)
at Object.next (/app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/internal/query-executor.js:32:53)
at /app/server/node_modules/.pnpm/[email protected]/node_modules/neo4j-driver-core/lib/internal/query-executor.js:26:71 {
constructor: [Function: Neo4jError] { isRetriable: [Function (anonymous)] },
code: 'Neo.ClientError.Statement.SyntaxError',
retriable: false
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.