How to use the neo4j-driver.session function in neo4j-driver

To help you get started, we’ve selected a few neo4j-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neo4j / neo4j-browser / src / shared / services / bolt / boltConnection.js View on Github external
.then(multiDbSupport => {
      if (!driver || !driver.session) return rej('No connection')
      const tmp = driver.session({
        defaultAccessMode: neo4j.session.READ,
        database: multiDbSupport ? 'system' : undefined
      })
      tmp
        .run('CALL db.indexes()')
        .then(() => {
          tmp.close()
          res(driver)
        })
        .catch(e => {
          // Only invalidate the connection if not available
          // or not authed
          // or credentials have expired
          const invalidStates = [
            'ServiceUnavailable',
            'Neo.ClientError.Security.AuthenticationRateLimit',
            'Neo.ClientError.Security.Unauthorized',
github neo4j / neo4j-browser / src / shared / services / bolt / boltConnection.js View on Github external
export function directTransaction(
  input,
  parameters,
  requestId = null,
  cancelable = false,
  txMetadata = undefined,
  useDb = undefined
) {
  const session = _drivers
    ? _drivers
        .getDirectDriver()
        .session({ defaultAccessMode: neo4j.session.WRITE, database: useDb })
    : false
  if (!cancelable) return _transaction(input, parameters, session, txMetadata)
  return _trackedTransaction(input, parameters, session, requestId, txMetadata)
}