Giter VIP home page Giter VIP logo

docs-drivers's Introduction

Neo4j Driver Documentation

Contents

This repository contains the AsciiDoc and other sources to build the Neo4j Driver Manual.

The examples for each of the driver languages are generated out of each driver’s source code repository:

Usage

  1. Clone the repository and checkout the branch you want to build.

  2. npm install to install the required node.js packages

  3. To build and view the HTML: npm start

Notes

This repo mostly functions in the same way as any other Antora repo, such as docs-getting-started, docs-java-reference.

The key difference with driver-documentation is that it includes remote content from the Neo4j Driver repos. To do this, the repo uses the neo4j-documentation/remote-include package as an asciidoc extension.

Code from the driver repos is included by adding attributes to the antora.yml file. The antora.yml file contains an attribute that contains a path to the examples.

Note that from Antora 3.1.0, attributes can be referenced by other attributes, allowing the following configuration:

asciidoc:
  attributes:
    dotnet-driver-apidoc-version: '4.4'
    dotnet-examples: https://raw.githubusercontent.com/neo4j/neo4j-dotnet-driver/{dotnet-driver-apidoc-version}/Neo4j.Driver/Neo4j.Driver.Tests.Integration

In the driver code repo, include example code, with a start and end tag:

            // tag::transaction-function[]
            public void AddPerson(string name)
            {
                using (var session = Driver.Session())
                {
                    session.WriteTransaction(tx => tx.Run("CREATE (a:Person {name: $name})", new {name}).Consume());
                }
            }
            // end::transaction-function[]

In a page, to include the transaction-function code, use the {dotnet-examples} attribute, adding the tag to the options:

[source, csharp, indent=0]
----
include::{dotnet-examples}/Examples.cs[tags=transaction-function]
----

docs-drivers's People

Contributors

alexicawright avatar ali-ince avatar bigmontz avatar davidoliversp2 avatar dependabot[bot] avatar fbiville avatar gjmwoods avatar injectives avatar jjaderberg avatar jpryce-aklundh avatar jsoref avatar juancri avatar lidiazuin avatar markwoulfeneo4j avatar martin-neotech avatar michael-simons avatar nataliaivakina avatar nawroth avatar pe4cey avatar recrwplay avatar renetapopova avatar robsdedude avatar stefano-ottolenghi avatar technige avatar zhenlineo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs-drivers's Issues

Update query from the documentation not working

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
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.