Home Reference Source
import Driver from 'neo4j-driver/lib/v1/driver.js'
public class | source

Driver

Direct Subclass:

src/v1/routing-driver.js~RoutingDriver

A driver maintains one or more Sessions with a remote Neo4j instance. Through the Sessions you can send statements and retrieve results from the database.

Drivers are reasonably expensive to create - you should strive to keep one driver instance around per Neo4j Instance you connect to.

Member Summary

Public Members
public get

onCompleted: null | function: *

this get was deprecated. driver can be used directly once instantiated, use of this callback is not required.

Get the installed connectivity verification callback.

public set

onCompleted(callback: null | function)

this set was deprecated. driver can be used directly once instantiated, use of this callback is not required.

Install a connectivity verification callback.

Method Summary

Public Methods
public

close(): *

Close all open sessions and other associated resources.

public

session(mode: string, bookmarkOrBookmarks: string | string[]): Session

Acquire a session to communicate with the database.

Public Members

public get onCompleted: null | function: * source

this get was deprecated. driver can be used directly once instantiated, use of this callback is not required.

Get the installed connectivity verification callback.

Return:

null | function

public set onCompleted(callback: null | function) source

this set was deprecated. driver can be used directly once instantiated, use of this callback is not required.

Install a connectivity verification callback.

Public Methods

public close(): * source

Close all open sessions and other associated resources. You should make sure to use this when you are done with this driver instance.

Return:

*

undefined

public session(mode: string, bookmarkOrBookmarks: string | string[]): Session source

Acquire a session to communicate with the database. The driver maintains a pool of sessions, so calling this method is normally cheap because you will be pulling a session out of the common pool.

This comes with some responsibility - make sure you always call close when you are done using a session, and likewise, make sure you don't close your session before you are done using it. Once it is returned to the pool, the session will be reset to a clean state and made available for others to use.

Params:

NameTypeAttributeDescription
mode string
  • optional
  • default: WRITE

the access mode of this session, allowed values are READ and WRITE.

bookmarkOrBookmarks string | string[]
  • optional
  • default: null

the initial reference or references to some previous transactions. Value is optional and absence indicates that that the bookmarks do not exist or are unknown.

Return:

Session

new session.