ISO GQL: A Defining Moment in the History of Database Innovation Learn More

The Neo4j Graph Platform – The #1 Platform for Connected Data
Neo4j logo

Neo4j AuraDB

Experience the lightning-fast speed and scalability of Neo4j's fully managed cloud database service for your application.
No credit card required
Prebuilt dataset
Interactive guide

Features

Everything you need to supercharge your next project
1-Click Database Setup

Get your graph database setup in the cloud with 1-Click setup

Scale On-Demand

Scale your database on-demand with no downtime

Driver Integrations

Use Neo4j with your favorite programming language and frameworks

Developer Tools

Jumpstart your next project with visualization and data importing tools, starter kits, and more

Automated Upgrades and Backups

Let us take care of database maintenance so you stay focused on what you do best

Enterprise-Class Security

Get granular security with advanced controls to protect sensitive data and meet compliance requirements.

Seamlessly Integrate with Your Project

No matter your technology stack, we've got you covered with our official and community drivers.
// npm install --save neo4j-driver
// node example.js

const neo4j = require('neo4j-driver')
const driver = neo4j.driver("neo4j+s://:", neo4j.auth.basic("", ""));

const query = `
MATCH (actor:Person
{ name: $actorName})-[:ACTED_IN]->(:Movie) < -[:ACTED_IN] - (p: Person)
RETURN p.name as coActorName
`;
const params = { actorName: "Tom Hanks" };

try {
    const { records } = await driver.executeQuery(query, params, { 
        database: 'neo4j'
    });
    records.forEach(record => console.log(record.get("coActorName")));
} catch (error) {
    console.log(error)
} finally {
    await driver.close()
}
# pip3 install neo4j
# python3 example.py

from neo4j import GraphDatabase

cypher_query = """
MATCH (actor:Person {name: $actorName})-[:ACTED_IN]->(:Movie)<-[:ACTED_IN]-(p: Person)
RETURN p.name as coActorName
"""

with GraphDatabase.driver(
    "neo4j+s://:",
    auth=("", "")
) as driver:
    result = driver.execute_query(
        cypher_query,
        actorName="Tom Hanks",
        database_="movies")
    for record in result.records:
        print(record["coActorName"])

# (see also https://github.com/neo4j-graph-examples/template/blob/491fde09ec246f49b6261696be7aef575f380e88/code/python/example.py)
// install a recent version of Go
// run: go mod init example.com/first-neo4j-run
// paste the code in main.go
// update the connection URI and credentials
// run: go run main.go

package main

import (
   "context"
   "fmt"
   "github.com/neo4j/neo4j-go-driver/v5/neo4j"
   "strings"
)

func main() {
   driver, err := neo4j.NewDriverWithContext("neo4j://:",
      neo4j.BasicAuth("", "", ""))
   if err != nil {
      panic(err)
   }
   defer handleClose(driver)

   ctx := context.Background() // learn more about contexts in https://pkg.go.dev/context
   names, err := runQuery(ctx, driver)
   if err != nil {
      panic(err)
   }
   fmt.Printf(" - %s\n", strings.Join(names, "\n - "))
}

func runQuery(ctx context.Context, driver neo4j.DriverWithContext) ([]string, error) {
   result, err := neo4j.ExecuteQuery(ctx,
      driver,
      `MATCH (actor:Person {name: $actorName})-[:ACTED_IN]->(:Movie)<-[:ACTED_IN]-(p:Person)
      RETURN p.name as coActorName`,
      map[string]any{"actorName": "Tom Hanks"},
      neo4j.EagerResultTransformer,
      neo4j.ExecuteQueryWithReadersRouting(),
      neo4j.ExecuteQueryWithDatabase("neo4j"))
   if err != nil {
      return nil, err
   }

   names := make([]string, len(result.Records))
   for i, record := range result.Records {
      name, _, err := neo4j.GetRecordValue[string](record, "coActorName")
      if err != nil {
         return nil, err
      }
      names[i] = name
   }
   return names, nil
}

func handleClose(closer interface{ Close(context.Context) error }) {
   if err := closer.Close(context.Background()); err != nil {
      panic(err)
   }
}
// Download the latest version of the Neo4j Java Driver along with the compatible version of Reactive Streams into your working directory.

// To download the latest version of the Neo4j Java Driver:
// 1. Navigate to the following URL https://central.sonatype.com/artifact/org.neo4j.driver/neo4j-java-driver-all.
// 2. Click Versions and then Browse next to the latest driver version.
// 3. Download the latest neo4j-java-driver-all jar.

// To download the compatible version of Reactive Streams:
// 1. Navigate to the following URL https://central.sonatype.com/artifact/org.neo4j.driver/neo4j-java-driver-all.
// 2. Click Dependencies and find reactive-streams.
// 3. Note the version and click View all.
// 4. Click Browse next to the noted version.
// 5. Download the latest reactive-streams jar.

// Follow the steps below to run the example code:
// 1. Make a new directory and place the downloaded jars there.
// 2. Copy and paste the code below into a file named `Example.java`.
// 3. Enter the information for the AuraDB instance you want to connect to by replacing:
// `:` with the AuraDB host and port.
// `` with the username.
// `` with the password.
// 4. Use the following command to compile the java file, replacing `` with your installed driver version:
// javac -cp neo4j-java-driver-all-.jar Example.java
// 5. Use the following command to run the example code, replacing `` with your installed driver version and `` with your installed Reactive Streams version:
// java -cp neo4j-java-driver-all-.jar:reactive-streams-.jar:. Example

import org.neo4j.driver.AuthTokens;
import org.neo4j.driver.GraphDatabase;
import org.neo4j.driver.QueryConfig;

import java.util.Map;

public class Example {
    public static void main(String... args) {
        var authToken = AuthTokens.basic("", "");
        try (var driver = GraphDatabase.driver("neo4j+s://:", authToken)) {
            var queryConfig = QueryConfig.builder()
                    .withDatabase("neo4j")
                    .build();
            var result = driver.executableQuery("""
                            MATCH (actor:Person {name: $actorName})-[:ACTED_IN]->(:Movie)<-[:ACTED_IN]-(p:Person)
                            RETURN p.name as coActorName""")
                    .withParameters(Map.of("actorName", "Tom Hanks"))
                    .withConfig(queryConfig)
                    .execute();
            result.records().forEach(record -> System.out.println(record.get("coActorName").asString()));
        }
    }
}
Output
{
  "coActorName" : [
    "Gary Sinise",
    "Kevin Bacon",
    "Bill Paxton",
    "Parker Posey",
    "Greg Kinnear",
    "Meg Ryan",
    "Steve Zahn",
    "Dave Chappelle",
    "Madonna",
    "Rosie O'Donnell",
    "Geena Davis",
    "Bill Paxton",
    "Lori Petty",
    "Nathan Lane",
    "Meg Ryan",
    "Liv Tyler",
    "Charlize Theron",
    "Ian McKellen",
    "Audrey Tautou",
    "Paul Bettany",
    "Jim Broadbent",
    "Halle Berry",
    "Hugo Weaving",
    "Helen Hunt",
    "Sam Rockwell",
    "Bonnie Hunt",
    "Patricia Clarkson",
    "James Cromwell",
    "Michael Clarke Duncan",
    "David Morse",
    "Gary Sinise",
    "Meg Ryan",
    "Victor Garber",
    "Bill Pullman",
    "Rita Wilson",
    "Rosie O'Donnell",
    "Julia Roberts",
    "Philip Seymour Hoffman",
  ]
}

Get Started for Free with AuraDB