Class ArangoConnection

A class that manages instances of ArangoDB classes.

An ArangoDB instance deals with only one ArangoJS Database. If you only need to work with one database, then simply use the ArangoDB class directly, but if you want to use different databases interchangeably in the same code, then ArangoConnection could potentially make that easier. The current limitation, however, is that it only manages multiple database connections (or instances) for the same ArangoJS Config credentials. In other words, you can easily (and only) work with multiple databases that use the same connection credentials.

The constructor accepts an ArangoJS Config

import { aql } from "arangojs/aql";
import { ArangoConnection } from "@distributhor/guacamole";

const conn = new ArangoConnection({
databaseName: db1,
url: process.env.GUACAMOLE_TEST_DB_URI,
auth: { username: dbAdminUser, password: dbAdminPassword }
})

const db1: ArangoDB = conn.db(dbName2)
const db2: ArangoDB = conn.db(dbName2)

const col1 = conn.db(dbName1).col(collectionName1)
const doc1 = await conn.db(dbName2).read({ id: 12345678 })
const result1: ArrayCursor = await conn.db(dbName3).query(aql)

const arangojsDb1: Database = conn.db(dbName1).driver()
const col1 = arangojsDb1.collection(collectionName1)
const doc1 = conn.db(dbName2).driver().document(id)

Hierarchy

  • ArangoConnection

Constructors

Properties

Methods

Constructors

Properties

system: Database

Methods

  • Parameters

    • db: string

    Returns Database

Generated using TypeDoc