Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "database"

import { Database } from "arangojs/database";

The "database" module provides the Database class and associated types and interfaces for TypeScript.

The Database class is also re-exported by the "index" module.

Index

Type aliases

AqlUserFunction

AqlUserFunction: { code: string; isDeterministic: boolean; name: string }

TODO

Type declaration

  • code: string
  • isDeterministic: boolean
  • name: string

AstNode

AstNode: { subNodes: AstNode[]; type: string }

TODO

Type declaration

  • [key: string]: any
  • subNodes: AstNode[]
  • type: string

CreateDatabaseOptions

CreateDatabaseOptions: { minReplicationFactor?: undefined | number; replicationFactor?: "satellite" | number; sharding?: "" | "flexible" | "single"; users?: CreateDatabaseUser[]; writeConcern?: undefined | number }

Options for creating a database. See Database.createDatabase.

Type declaration

  • Optional minReplicationFactor?: undefined | number

    (Cluster only.) Default write concern for new collections created in this database.

    deprecated

    Renamed to writeConcern in ArangoDB 3.6.

  • Optional replicationFactor?: "satellite" | number

    (Cluster only.) Default replication factor for new collections in this database.

    Setting this to 1 disables replication. Setting this to "satellite" will replicate to every DBServer.

  • Optional sharding?: "" | "flexible" | "single"

    (Cluster only.) The sharding method to use for new collections in the database.

  • Optional users?: CreateDatabaseUser[]

    Database users to create with the database.

  • Optional writeConcern?: undefined | number

    (Cluster only.) Default write concern for new collections created in this database.

CreateDatabaseUser

CreateDatabaseUser: { active?: undefined | false | true; extra?: Dict<any>; passwd?: undefined | string; username: string }

Database user to create with a database.

Type declaration

  • Optional active?: undefined | false | true

    Whether the user is active.

    Default: true

  • Optional extra?: Dict<any>

    Additional data to store with the user object.

  • Optional passwd?: undefined | string

    Password of the user to create.

    Default: ""

  • username: string

    Username of the user to create.

DatabaseInfo

DatabaseInfo: { id: string; isSystem: boolean; minReplicationFactor?: undefined | number; name: string; path: string; replicationFactor?: "satellite" | number; sharding?: "" | "flexible" | "single"; writeConcern?: undefined | number }

TODO

Type declaration

  • id: string
  • isSystem: boolean
  • Optional minReplicationFactor?: undefined | number
    deprecated

    Renamed to writeConcern in ArangoDB 3.6.

  • name: string
  • path: string
  • Optional replicationFactor?: "satellite" | number
  • Optional sharding?: "" | "flexible" | "single"
  • Optional writeConcern?: undefined | number

ExplainOptions

ExplainOptions: { allPlans?: undefined | false | true; maxNumberOfPlans?: undefined | number; optimizer?: undefined | { rules: string[] } }

Options for explaining a query. See Database.explain.

Type declaration

  • Optional allPlans?: undefined | false | true

    If set to true, all possible execution plans will be returned as the plans property. Otherwise only the optimal execution plan will be returned as the plan property.

    Default: false

  • Optional maxNumberOfPlans?: undefined | number

    Maximum number of plans that the optimizer is allowed to generate. Setting this to a low value limits the amount of work the optimizer does.

  • Optional optimizer?: undefined | { rules: string[] }

    An object with a rules property specifying a list of optimizer rules to be included or excluded by the optimizer for this query. Prefix a rule name with + to include it, or - to exclude it. The name all acts as an alias matching all optimizer rules.

ExplainPlan

ExplainPlan: { collections: { name: string; type: "read" | "write" }[]; estimatedCost: number; estimatedNrItems: number; initialize: boolean; isModificationQuery: boolean; nodes: { dependencies: number[]; estimatedCost: number; estimatedNrItems: number; id: number; type: string }[]; rules: string[]; variables: { id: number; name: string }[] }

TODO

Type declaration

  • collections: { name: string; type: "read" | "write" }[]
  • estimatedCost: number
  • estimatedNrItems: number
  • initialize: boolean
  • isModificationQuery: boolean
  • nodes: { dependencies: number[]; estimatedCost: number; estimatedNrItems: number; id: number; type: string }[]
  • rules: string[]
  • variables: { id: number; name: string }[]

InstallServiceOptions

InstallServiceOptions: { configuration?: Dict<any>; dependencies?: Dict<string>; development?: undefined | false | true; legacy?: undefined | false | true; setup?: undefined | false | true }

Options for installing the service.

See Database.installService.

Type declaration

  • Optional configuration?: Dict<any>

    An object mapping configuration option names to values.

    See also Database.getServiceConfiguration.

  • Optional dependencies?: Dict<string>

    An object mapping dependency aliases to mount points.

    See also Database.getServiceDependencies.

  • Optional development?: undefined | false | true

    Whether the service should be installed in development mode.

    See also Database.setServiceDevelopmentMode.

    Default: false

  • Optional legacy?: undefined | false | true

    Whether the service should be installed in legacy compatibility mode

    This overrides the engines option in the service manifest (if any).

    Default: false

  • Optional setup?: undefined | false | true

    Whether the "setup" script should be executed.

    Default: true

MultiExplainResult

MultiExplainResult: { plans: ExplainPlan[]; stats: { plansCreated: number; rulesExecuted: number; rulesSkipped: number }; warnings: { code: number; message: string }[] }

TODO

Type declaration

  • plans: ExplainPlan[]
  • stats: { plansCreated: number; rulesExecuted: number; rulesSkipped: number }
    • plansCreated: number
    • rulesExecuted: number
    • rulesSkipped: number
  • warnings: { code: number; message: string }[]

MultiServiceDependency

MultiServiceDependency: { current?: string[]; description?: undefined | string; multiple: true; name: string; required: boolean; title: string; version: string }

TODO

Type declaration

  • Optional current?: string[]
  • Optional description?: undefined | string
  • multiple: true
  • name: string
  • required: boolean
  • title: string
  • version: string

ParseResult

ParseResult: { ast: AstNode[]; bindVars: string[]; collections: string[]; parsed: boolean }

TODO

Type declaration

  • ast: AstNode[]
  • bindVars: string[]
  • collections: string[]
  • parsed: boolean

QueryInfo

QueryInfo: { bindVars: Dict<any>; id: string; query: string; runTime: number; started: string; state: "executing" | "finished" | "killed"; stream: boolean }

TODO

Type declaration

  • bindVars: Dict<any>
  • id: string
  • query: string
  • runTime: number
  • started: string
  • state: "executing" | "finished" | "killed"
  • stream: boolean

QueryOptions

QueryOptions: { allowDirtyRead?: undefined | false | true; batchSize?: undefined | number; cache?: undefined | false | true; count?: undefined | false | true; failOnWarning?: undefined | false | true; fullCount?: undefined | false | true; intermediateCommitCount?: undefined | number; intermediateCommitSize?: undefined | number; maxPlans?: undefined | number; maxRuntime?: undefined | number; maxTransactionSize?: undefined | number; maxWarningsCount?: undefined | number; memoryLimit?: undefined | number; optimizer?: undefined | { rules: string[] }; profile?: boolean | number; satelliteSyncWait?: undefined | number; skipInaccessibleCollections?: undefined | false | true; stream?: undefined | false | true; timeout?: undefined | number; ttl?: undefined | number }

Options for executing a query. See Database.query.

Type declaration

  • Optional allowDirtyRead?: undefined | false | true

    If set to true, the query will be executed with support for dirty reads enabled, permitting ArangoDB to return a potentially dirty or stale result and arangojs will load balance the request without distinguishing between leaders and followers.

    Note that dirty reads are only supported for read-only queries, not data modification queries (e.g. using INSERT, UPDATE, REPLACE or REMOVE) and only when using ArangoDB 3.4 or later.

    Default: false

  • Optional batchSize?: undefined | number

    The number of result values to be transferred by the server in each network roundtrip (or "batch").

    Must be greater than zero.

  • Optional cache?: undefined | false | true

    If set to false, the AQL query results cache lookup will be skipped for this query.

    Default: true

  • Optional count?: undefined | false | true

    Unless set to false, the number of result values in the result set will be returned in the count attribute. This may be disabled by default in a future version of ArangoDB if calculating this value has a performance impact for some queries.

    Default: true.

  • Optional failOnWarning?: undefined | false | true

    If set to true, the query will throw an exception and abort if it would otherwise produce a warning.

  • Optional fullCount?: undefined | false | true

    If set to true and the query has a LIMIT clause, the total number of values matched before the last top-level LIMIT in the query was applied will be returned in the extra.stats.fullCount attribute.

  • Optional intermediateCommitCount?: undefined | number

    (RocksDB only.) Maximum number of operations after which an intermediate commit is automatically performed.

  • Optional intermediateCommitSize?: undefined | number

    (RocksDB only.) Maximum total size of operations in bytes after which an intermediate commit is automatically performed.

  • Optional maxPlans?: undefined | number

    Limits the maximum number of plans that will be created by the AQL query optimizer.

  • Optional maxRuntime?: undefined | number

    Maximum allowed execution time before the query will be killed in seconds.

    If set to 0, the query will be allowed to run indefinitely.

    Default: 0

  • Optional maxTransactionSize?: undefined | number

    (RocksDB only.) Maximum size of transactions in bytes.

  • Optional maxWarningsCount?: undefined | number

    Limits the maximum number of warnings a query will return.

  • Optional memoryLimit?: undefined | number

    The maximum memory size in bytes that the query is allowed to use. Exceeding this value will result in the query failing with an error.

    If set to 0, the memory limit is disabled.

    Default: 0

  • Optional optimizer?: undefined | { rules: string[] }

    An object with a rules property specifying a list of optimizer rules to be included or excluded by the optimizer for this query. Prefix a rule name with + to include it, or - to exclude it. The name all acts as an alias matching all optimizer rules.

  • Optional profile?: boolean | number

    If set to 1 or true, additional query profiling information will be returned in the extra.profile attribute if the query is not served from the result cache.

    If set to 2, the query will return execution stats per query plan node in the extra.stats.nodes attribute. Additionally the query plan is returned in extra.plan.

  • Optional satelliteSyncWait?: undefined | number

    (Enterprise Edition cluster only.) Limits the maximum time in seconds a DBServer will wait to bring satellite collections involved in the query into sync. Exceeding this value will result in the query being stopped.

    Default: 60

  • Optional skipInaccessibleCollections?: undefined | false | true

    (Enterprise Edition cluster only.) If set to true, collections inaccessible to the current user will result in an access error instead of being treated as empty.

  • Optional stream?: undefined | false | true

    If set to true, the query will be executed as a streaming query.

  • Optional timeout?: undefined | number

    Maximum time in milliseconds arangojs will wait for a server response. Exceeding this value will result in the request being cancelled.

    Note: Setting a timeout for the client does not guarantee the query will be killed by ArangoDB if it is already being executed. See the maxRuntime option for limiting the execution time within ArangoDB.

  • Optional ttl?: undefined | number

    The time-to-live for the cursor in seconds. The cursor results may be garbage collected by ArangoDB after this much time has passed.

    Default: 30

QueryTracking

QueryTracking: { enabled: boolean; maxQueryStringLength: number; maxSlowQueries: number; slowQueryThreshold: number; trackBindVars: boolean; trackSlowQueries: boolean }

TODO

Type declaration

  • enabled: boolean
  • maxQueryStringLength: number
  • maxSlowQueries: number
  • slowQueryThreshold: number
  • trackBindVars: boolean
  • trackSlowQueries: boolean

QueryTrackingOptions

QueryTrackingOptions: { enabled?: undefined | false | true; maxQueryStringLength?: undefined | number; maxSlowQueries?: undefined | number; slowQueryThreshold?: undefined | number; trackBindVars?: undefined | false | true; trackSlowQueries?: undefined | false | true }

Options for query tracking. See Database.queryTracking.

Type declaration

  • Optional enabled?: undefined | false | true

    If set to false, neither queries nor slow queries will be tracked.

  • Optional maxQueryStringLength?: undefined | number

    The maximum query string length in bytes that will be kept in the list.

  • Optional maxSlowQueries?: undefined | number

    The maximum number of slow queries to be kept in the list.

  • Optional slowQueryThreshold?: undefined | number

    The threshold execution time in seconds for when a query will be considered slow.

  • Optional trackBindVars?: undefined | false | true

    If set to true, bind parameters will be tracked along with queries.

  • Optional trackSlowQueries?: undefined | false | true

    If set to true and enabled is also set to true, slow queries will be tracked if their execution time exceeds slowQueryThreshold.

ReplaceServiceOptions

ReplaceServiceOptions: InstallServiceOptions & { force?: undefined | false | true; teardown?: undefined | false | true }

Options for replacing a service.

See Database.replaceService.

ServiceConfiguration

ServiceConfiguration: { current: any; currentRaw: any; default?: any; description?: undefined | string; required: boolean; title: string; type: "integer" | "boolean" | "string" | "number" | "json" | "password" | "int" | "bool" }

TODO

Type declaration

  • current: any
  • currentRaw: any
  • Optional default?: any
  • Optional description?: undefined | string
  • required: boolean
  • title: string
  • type: "integer" | "boolean" | "string" | "number" | "json" | "password" | "int" | "bool"

ServiceDependency

TODO

ServiceInfo

ServiceInfo: { checksum: string; development: boolean; legacy: boolean; manifest: FoxxManifest; mount: string; name?: undefined | string; options: { configuration: Dict<any>; dependencies: Dict<string> }; path: string; version?: undefined | string }

TODO

Type declaration

  • checksum: string
  • development: boolean
  • legacy: boolean
  • manifest: FoxxManifest
  • mount: string
  • Optional name?: undefined | string
  • options: { configuration: Dict<any>; dependencies: Dict<string> }
    • configuration: Dict<any>
    • dependencies: Dict<string>
  • path: string
  • Optional version?: undefined | string

ServiceSummary

ServiceSummary: { development: boolean; legacy: boolean; mount: string; name?: undefined | string; provides: Dict<string>; version?: undefined | string }

TODO

Type declaration

  • development: boolean
  • legacy: boolean
  • mount: string
  • Optional name?: undefined | string
  • provides: Dict<string>
  • Optional version?: undefined | string

ServiceTestDefaultReport

ServiceTestDefaultReport: { failures: ServiceTestDefaultTest[]; passes: ServiceTestDefaultTest[]; pending: ServiceTestDefaultTest[]; stats: ServiceTestStats; tests: ServiceTestDefaultTest[] }

Test results for a Foxx service's tests using the default reporter.

Type declaration

ServiceTestDefaultTest

ServiceTestDefaultTest: { duration: number; err?: undefined | string; fullTitle: string; title: string }

Test results for a single test case using the default reporter.

Type declaration

  • duration: number
  • Optional err?: undefined | string
  • fullTitle: string
  • title: string

ServiceTestStats

ServiceTestStats: { duration: number; failures: number; passes: number; pending: number; tests: number }

Test stats for a Foxx service's tests.

Type declaration

  • duration: number
  • failures: number
  • passes: number
  • pending: number
  • tests: number

ServiceTestStreamReport

ServiceTestStreamReport: (["start", { total: number }] | ["pass", { duration: number; err?: undefined | string; fullTitle: string; title: string }] | ["fail", { duration: number; err?: undefined | string; fullTitle: string; title: string }] | ["end", { duration: number; failures: number; passes: number; pending: number; tests: number }])[]

Test results for a Foxx service's tests using the stream reporter.

ServiceTestStreamTest

ServiceTestStreamTest: { duration: number; err?: undefined | string; fullTitle: string; title: string }

Test results for a single test case using the stream reporter.

Type declaration

  • duration: number
  • Optional err?: undefined | string
  • fullTitle: string
  • title: string

ServiceTestSuite

ServiceTestSuite: { suites: ServiceTestSuite[]; tests: ServiceTestSuiteTest[]; title: string }

Test results for a single test suite using the suite reporter.

Type declaration

ServiceTestSuiteReport

ServiceTestSuiteReport: { stats: ServiceTestStats; suites: ServiceTestSuite[]; tests: ServiceTestSuiteTest[] }

Test results for a Foxx service's tests using the suite reporter.

Type declaration

ServiceTestSuiteTest

ServiceTestSuiteTest: { duration: number; err?: any; result: "pending" | "pass" | "fail"; title: string }

Test results for a single test case using the suite reporter.

Type declaration

  • duration: number
  • Optional err?: any
  • result: "pending" | "pass" | "fail"
  • title: string

ServiceTestTapReport

ServiceTestTapReport: string[]

Test results for a Foxx service's tests in TAP format.

ServiceTestXunitReport

ServiceTestXunitReport: ["testsuite", { errors: number; failures: number; skip: number; tests: number; time: number; timestamp: number }, ["testcase", { classname: string; name: string; time: number }] | ["testcase", { classname: string; name: string; time: number }, ["failure", { message: string; type: string }, string]]]

Test results for a Foxx service's tests in XUnit format using the JSONML representation.

ServiceTestXunitTest

ServiceTestXunitTest: ["testcase", { classname: string; name: string; time: number }] | ["testcase", { classname: string; name: string; time: number }, ["failure", { message: string; type: string }, string]]

Test results for a single test case in XUnit format using the JSONML representation.

SingleExplainResult

SingleExplainResult: { cacheable: boolean; plan: ExplainPlan; stats: { plansCreated: number; rulesExecuted: number; rulesSkipped: number }; warnings: { code: number; message: string }[] }

TODO

Type declaration

  • cacheable: boolean
  • plan: ExplainPlan
  • stats: { plansCreated: number; rulesExecuted: number; rulesSkipped: number }
    • plansCreated: number
    • rulesExecuted: number
    • rulesSkipped: number
  • warnings: { code: number; message: string }[]

SingleServiceDependency

SingleServiceDependency: { current?: undefined | string; description?: undefined | string; multiple: false; name: string; required: boolean; title: string; version: string }

TODO

Type declaration

  • Optional current?: undefined | string
  • Optional description?: undefined | string
  • multiple: false
  • name: string
  • required: boolean
  • title: string
  • version: string

SwaggerJson

SwaggerJson: { info: { description: string; license: string; title: string; version: string }; path: {} }

OpenAPI 2.0 description of a Foxx service.

Type declaration

  • [key: string]: any
  • info: { description: string; license: string; title: string; version: string }
    • description: string
    • license: string
    • title: string
    • version: string
  • path: {}
    • [key: string]: any

TransactionCollections

TransactionCollections: { exclusive?: (string | ArangoCollection)[] | string | ArangoCollection; read?: (string | ArangoCollection)[] | string | ArangoCollection; write?: (string | ArangoCollection)[] | string | ArangoCollection }

Collections involved in a transaction.

Type declaration

  • Optional exclusive?: (string | ArangoCollection)[] | string | ArangoCollection

    An array of collections or a single collection that will be read from or written to during the transaction with no other writes being able to run in parallel.

  • Optional read?: (string | ArangoCollection)[] | string | ArangoCollection

    An array of collections or a single collection that will be read from during the transaction.

  • Optional write?: (string | ArangoCollection)[] | string | ArangoCollection

    An array of collections or a single collection that will be read from or written to during the transaction.

    If ArangoDB is using the MMFiles storage engine, this option behaves exactly like exclusive, i.e. no other writes will run in parallel.

TransactionDetails

TransactionDetails: { id: string; state: "running" | "committed" | "aborted" }

TODO

Type declaration

  • id: string
  • state: "running" | "committed" | "aborted"

TransactionOptions

TransactionOptions: { allowImplicit?: undefined | false | true; intermediateCommitCount?: undefined | number; intermediateCommitSize?: undefined | number; lockTimeout?: undefined | number; maxTransactionSize?: undefined | number; waitForSync?: undefined | false | true }

Options for how the transaction should be performed.

Type declaration

  • Optional allowImplicit?: undefined | false | true

    Whether the transaction may read from collections not specified for this transaction. If set to false, accessing any collections not specified will result in the transaction being aborted to avoid potential deadlocks.

    Default: true.

  • Optional intermediateCommitCount?: undefined | number

    (RocksDB only.) Determines the maximum number of operations after which an intermediate commit is performed automatically.

    deprecated

    Removed in ArangoDB 3.4.

  • Optional intermediateCommitSize?: undefined | number

    (RocksDB only.) Determine the maximum total size of operations after which an intermediate commit is performed automatically.

    deprecated

    Removed in ArangoDB 3.4.

  • Optional lockTimeout?: undefined | number

    Determines how long the database will wait while attempting to gain locks on collections used by the transaction before timing out.

  • Optional maxTransactionSize?: undefined | number

    (RocksDB only.) Determines the transaction size limit in bytes.

  • Optional waitForSync?: undefined | false | true

    Determines whether to force the transaction to write all data to disk before returning.

UninstallServiceOptions

UninstallServiceOptions: { force?: undefined | false | true; teardown?: undefined | false | true }

Options for uninstalling a service.

See Database.uninstallService.

Type declaration

  • Optional force?: undefined | false | true

    If set to true, uninstalling a service that does not already exist will be considered successful.

    Default: false

  • Optional teardown?: undefined | false | true

    Whether the service's "teardown" script should be executed prior to removing that service.

    Default: true

UpgradeServiceOptions

UpgradeServiceOptions: InstallServiceOptions & { force?: undefined | false | true; teardown?: undefined | false | true }

Options for upgrading a service.

See Database.upgradeService.

VersionInfo

VersionInfo: { license: "community" | "enterprise"; server: string; version: string }

TODO

Type declaration

  • license: "community" | "enterprise"
  • server: string
  • version: string

Functions

isArangoDatabase

  • isArangoDatabase(database: any): database is Database
  • Indicates whether the given value represents a Database.

    Parameters

    • database: any

      A value that might be a database.

    Returns database is Database

Generated using TypeDoc