Creates a new Database
instance with its own connection pool.
See also Database.database.
An object with configuration options.
Creates a new Database
instance with its own connection pool.
See also Database.database.
Base URL of the ArangoDB server or list of server URLs.
Equivalent to the url
option in Config.
Name of the ArangoDB database this instance represents.
Methods for accessing the server-reported queue times of the mostly recently received responses.
Updates the URL list by requesting a list of all coordinators in the cluster and adding any endpoints not initially specified in the Config.
For long-running processes communicating with an ArangoDB cluster it is recommended to run this method periodically (e.g. once per hour) to make sure new coordinators are picked up correctly and can be used for fail-over or load balancing.
Fetches all Analyzers visible in the database and returns an array of Analyzer instances for those Analyzers.
See also Database.listAnalyzers.
Begins a new streaming transaction for the given collections, then returns a Transaction instance for the transaction.
Collections can be specified as collection names (strings) or objects
implementing the ArangoCollection interface: Collection
,
GraphVertexCollection, GraphEdgeCollection as well as
(in TypeScript) DocumentCollection and EdgeCollection.
Collections involved in the transaction.
Options for the transaction.
Begins a new streaming transaction for the given collections, then returns a Transaction instance for the transaction.
Collections can be specified as collection names (strings) or objects
implementing the ArangoCollection interface: Collection
,
GraphVertexCollection, GraphEdgeCollection as well as
(in TypeScript) DocumentCollection and EdgeCollection.
Collections that can be read from and written to during the transaction.
Options for the transaction.
Begins a new streaming transaction for the given collections, then returns a Transaction instance for the transaction.
The Collection can be specified as a collection name (string) or an object
implementing the ArangoCollection interface: Collection
,
GraphVertexCollection, GraphEdgeCollection as well as
(in TypeScript) DocumentCollection and EdgeCollection.
Options for the transaction.
Clears the list of recent slow queries.
See also Database.listSlowQueries.
Clears the given ArangoDB user's access level for the database, or the given collection in the given database.
Name of the ArangoDB user to clear the access level for.
Closes all active connections of this database instance.
Can be used to clean up idling connections during longer periods of inactivity.
Note: This method currently has no effect in the browser version of arangojs.
Returns a Collection
instance for the given collection name.
In TypeScript the collection implements both the DocumentCollection and EdgeCollection interfaces and can be cast to either type to enforce a stricter API.
Type to use for document data. Defaults to any
.
Name of the edge collection.
Fetches all collections from the database and returns an array of
Collection
instances.
In TypeScript these instances implement both the DocumentCollection and EdgeCollection interfaces and can be cast to either type to enforce a stricter API.
See also Database.listCollections.
Whether system collections should be excluded.
Writes all locally available services to the database and updates any service bundles missing in the database.
If set to true
, outdated services will also be
committed. This can be used to solve some consistency problems when
service bundles are missing in the database or were deleted manually.
Creates a new Analyzer with the given analyzerName
and options
, then
returns an Analyzer instance for the new Analyzer.
Name of the Analyzer.
An object defining the properties of the Analyzer.
Creates a new collection with the given collectionName
and options
,
then returns a DocumentCollection instance for the new collection.
Type to use for document data. Defaults to any
.
Name of the new collection.
Options for creating the collection.
Creates a new edge collection with the given collectionName
and
options
, then returns an EdgeCollection instance for the new
edge collection.
Type to use for edge document data. Defaults to any
.
Name of the new collection.
Options for creating the collection.
Creates a new database with the given databaseName
with the given
options
and returns a Database
instance for that database.
Name of the database to create.
Options for creating the database.
Creates a new database with the given databaseName
with the given
users
and returns a Database
instance for that database.
Name of the database to create.
Database users to create with the database.
Creates a new edge collection with the given collectionName
and
options
, then returns an EdgeCollection instance for the new
edge collection.
This is a convenience method for calling Database.createCollection
with options.type
set to EDGE_COLLECTION
.
Type to use for edge document data. Defaults to any
.
Name of the new collection.
Options for creating the collection.
Creates an AQL user function with the given name and code if it does not already exist or replaces it if a function with the same name already existed.
A valid AQL function name. The function name must consist of at least two alphanumeric identifiers separated with double colons.
A string evaluating to a JavaScript function (not a JavaScript function object).
If set to true
, the function is expected to
always return the same result for equivalent inputs. This option currently
has no effect but may allow for optimizations in the future.
Creates a graph with the given graphName
and edgeDefinitions
, then
returns a Graph instance for the new graph.
Name of the graph to be created.
An array of edge definitions.
An object defining the properties of the graph.
Creates a new ArangoDB user with the given password.
Name of the ArangoDB user to create.
Password of the new ArangoDB user.
Creates a new ArangoDB user with the given options.
Name of the ArangoDB user to create.
Additional options for creating the ArangoDB user.
Creates a new ArangoSearch View with the given viewName
and options
and returns an ArangoSearchView instance for the created View.
Name of the ArangoSearch View.
An object defining the properties of the View.
Creates a new Database
instance for the given databaseName
that
shares this database's connection pool.
See also Database.constructor.
Name of the database.
Fetches all databases from the server and returns an array of Database
instances for those databases.
See also Database.listDatabases and Database.userDatabases.
Retrieves a zip bundle containing the service files.
Returns a Buffer
in node.js or Blob
in the browser.
The service's mount point, relative to the database.
Deletes the database with the given databaseName
from the server.
Name of the database to delete.
Deletes the AQL user function with the given name from the database.
The name of the user function to drop.
If set to true
, all functions with a name starting with
name
will be deleted, otherwise only the function with the exact name
will be deleted.
Performs a server-side JavaScript transaction and returns its return value.
Collections can be specified as collection names (strings) or objects
implementing the ArangoCollection interface: Collection
,
GraphVertexCollection, GraphEdgeCollection as well as
(in TypeScript) DocumentCollection and EdgeCollection.
Note: The action
function will be evaluated and executed on the
server inside ArangoDB's embedded JavaScript environment and can not
access any values other than those passed via the params
option.
See the official ArangoDB documentation for
the JavaScript @arangodb
module
for information about accessing the database from within ArangoDB's
server-side JavaScript environment.
Collections involved in the transaction.
A string evaluating to a JavaScript function to be executed on the server.
Options for the transaction. If options.allowImplicit
is specified, it will be used if collections.allowImplicit
was not
specified.
Performs a server-side transaction and returns its return value.
Collections can be specified as collection names (strings) or objects
implementing the ArangoCollection interface: Collection
,
GraphVertexCollection, GraphEdgeCollection as well as
(in TypeScript) DocumentCollection and EdgeCollection.
Note: The action
function will be evaluated and executed on the
server inside ArangoDB's embedded JavaScript environment and can not
access any values other than those passed via the params
option.
See the official ArangoDB documentation for
the JavaScript @arangodb
module
for information about accessing the database from within ArangoDB's
server-side JavaScript environment.
Collections that can be read from and written to during the transaction.
A string evaluating to a JavaScript function to be executed on the server.
Options for the transaction.
Performs a server-side transaction and returns its return value.
The Collection can be specified as a collection name (string) or an object
implementing the ArangoCollection interface: Collection
,
GraphVertexCollection, GraphEdgeCollection as well as
(in TypeScript) DocumentCollection and EdgeCollection.
Note: The action
function will be evaluated and executed on the
server inside ArangoDB's embedded JavaScript environment and can not
access any values other than those passed via the params
option.
See the official ArangoDB documentation for
the JavaScript @arangodb
module
for information about accessing the database from within ArangoDB's
server-side JavaScript environment.
A collection that can be read from and written to during the transaction.
A string evaluating to a JavaScript function to be executed on the server.
Options for the transaction.
Checks whether the database exists.
Explains a database query using the given query
.
See the aql template string handler for information about how to create a query string without manually defining bind parameters nor having to worry about escaping variables.
An object containing an AQL query string and bind parameters, e.g. the object returned from an aql template string.
Options for explaining the query.
Explains a database query using the given query
.
See the aql template string handler for information about how to create a query string without manually defining bind parameters nor having to worry about escaping variables.
An object containing an AQL query string and bind parameters, e.g. the object returned from an aql template string.
Options for explaining the query.
Explains a database query using the given query
and bindVars
.
See the aql template string handler for a safer and easier alternative to passing strings directly.
An AQL query string.
An object defining bind parameters for the query.
Options for explaining the query.
Explains a database query using the given query
and bindVars
.
See the aql template string handler for a safer and easier alternative to passing strings directly.
An AQL query string.
An object defining bind parameters for the query.
Options for explaining the query.
Fetches the database description for the active database from the server.
Retrieves information about a mounted service.
The service's mount point, relative to the database.
Retrieves information about the service's configuration options and their current values.
See also Database.replaceServiceConfiguration and Database.updateServiceConfiguration.
The service's mount point, relative to the database.
If set to true
, the result will only include each
configuration option's current value. Otherwise it will include the full
definition for each option.
Retrieves information about the service's configuration options and their current values.
See also Database.replaceServiceConfiguration and Database.updateServiceConfiguration.
The service's mount point, relative to the database.
If set to true
, the result will only include each
configuration option's current value. Otherwise it will include the full
definition for each option.
Retrieves information about the service's dependencies and their current mount points.
See also Database.replaceServiceDependencies and Database.updateServiceDependencies.
The service's mount point, relative to the database.
If set to true
, the result will only include each
dependency's current mount point. Otherwise it will include the full
definition for each dependency.
Retrieves information about the service's dependencies and their current mount points.
See also Database.replaceServiceDependencies and Database.updateServiceDependencies.
The service's mount point, relative to the database.
If set to true
, the result will only include each
dependency's current mount point. Otherwise it will include the full
definition for each dependency.
Retrieves an Open API compatible Swagger API description object for the service installed at the given mount point.
The service's mount point, relative to the database.
Retrieves the text content of the service's README
or README.md
file.
Returns undefined
if no such file could be found.
The service's mount point, relative to the database.
Fetches the user data of a single ArangoDB user.
Name of the ArangoDB user to fetch.
Fetches the given ArangoDB user's access level for the database, or the given collection in the given database.
Name of the ArangoDB user to fetch the access level for.
Fetches an object mapping names of databases to the access level of the given ArangoDB user for those databases.
Name of the ArangoDB user to fetch the access levels for.
Whether access levels for collections should be included.
Fetches an object mapping names of databases to the access level of the given ArangoDB user for those databases and the collections within each database.
Name of the ArangoDB user to fetch the access levels for.
Whether access levels for collections should be included.
Fetches all graphs from the database and returns an array of Graph instances for those graphs.
See also Database.listGraphs.
Installs a new service.
The service's mount point, relative to the database.
The service bundle to install.
Options for installing the service.
Kills a running query with the given queryId
.
See also Database.listRunningQueries.
The ID of a currently running query.
Fetches all Analyzers visible in the database and returns an array of Analyzer descriptions.
See also Database.analyzers.
Fetches all collections from the database and returns an array of collection descriptions.
See also Database.collections.
Whether system collections should be excluded.
Fetches all databases from the server and returns an array of their names.
See also Database.databases and Database.listUserDatabases.
Fetches a list of all AQL user functions registered with the database.
Fetches all graphs from the database and returns an array of graph descriptions.
See also Database.graphs.
Fetches a list of information for all currently running queries.
See also Database.listSlowQueries and Database.killQuery.
Retrieves a list of scripts defined in the service manifest's "scripts" section mapped to their human readable representations.
The service's mount point, relative to the database.
Fetches a list of all installed service.
Whether system services should be excluded.
Fetches a list of information for all recent slow queries.
See also Database.listRunningQueries and Database.clearSlowQueries.
Fetches all active transactions from the database and returns an array of transaction descriptions.
See also Database.transactions.
Fetches all databases accessible to the active user from the server and returns an array of their names.
See also Database.userDatabases and Database.listDatabases.
Fetches all ArangoDB users visible to the authenticated user and returns an array of user objects.
Fetches all Views from the database and returns an array of View descriptions.
See also Database.views.
Validates the given database credentials and exchanges them for an authentication token, then uses the authentication token for future requests and returns it.
The username to authenticate with.
The password to authenticate with.
Parses the given query and returns the result.
See the aql template string handler for information about how to create a query string without manually defining bind parameters nor having to worry about escaping variables.
An AQL query string or an object containing an AQL query string and bind parameters, e.g. the object returned from an aql template string.
Performs a database query using the given query
, then returns a new
ArrayCursor instance for the result set.
See the aql template string handler for information about how to create a query string without manually defining bind parameters nor having to worry about escaping variables.
An object containing an AQL query string and bind parameters, e.g. the object returned from an aql template string.
Options for the query execution.
Performs a database query using the given query
and bindVars
, then
returns a new ArrayCursor instance for the result set.
See the aql template string handler for a safer and easier alternative to passing strings directly.
An AQL query string.
An object defining bind parameters for the query.
Options for the query execution.
Fetches the query tracking properties.
Modifies the query tracking properties.
Options for query tracking.
Removes the ArangoDB user with the given username from the server.
Name of the ArangoDB user to remove.
Renames the collection collectionName
to newName
.
Additionally removes any stored Collection
instance for
collectionName
from the Database
instance's internal cache.
Note: Renaming collections may not be supported when ArangoDB is running in a cluster configuration.
Current name of the collection.
The new name of the collection.
Renames the view viewName
to newName
.
Additionally removes any stored View instance for viewName
from
the Database
instance's internal cache.
Note: Renaming views may not be supported when ArangoDB is running in a cluster configuration.
Current name of the view.
The new name of the view.
Replaces an existing service with a new service by completely removing the old service and installing a new service at the same mount point.
The service's mount point, relative to the database.
The service bundle to install.
Options for replacing the service.
Replaces the configuration of the given service, discarding any existing values for options not specified.
See also Database.updateServiceConfiguration and Database.getServiceConfiguration.
The service's mount point, relative to the database.
An object mapping configuration option names to values.
If set to true
, the result will only include each
configuration option's current value and warning (if any).
Otherwise it will include the full definition for each option.
Note: When using ArangoDB 3.2.8 or older, setting the minimal
option
to true
avoids triggering a second request to fetch the full
configuration definitions.
Replaces the configuration of the given service, discarding any existing values for options not specified.
See also Database.updateServiceConfiguration and Database.getServiceConfiguration.
The service's mount point, relative to the database.
An object mapping configuration option names to values.
If set to true
, the result will only include each
configuration option's current value and warning (if any).
Otherwise it will include the full definition for each option.
Note: When using ArangoDB 3.2.8 or older, setting the minimal
option
to true
avoids triggering a second request to fetch the full
configuration definitions.
Replaces the dependencies of the given service, discarding any existing mount points for dependencies not specified.
See also Database.updateServiceDependencies and Database.getServiceDependencies.
The service's mount point, relative to the database.
If set to true
, the result will only include each
dependency's current mount point. Otherwise it will include the full
definition for each dependency.
Note: When using ArangoDB 3.2.8 or older, setting the minimal
option
to true
avoids triggering a second request to fetch the full
dependency definitions.
Replaces the dependencies of the given service, discarding any existing mount points for dependencies not specified.
See also Database.updateServiceDependencies and Database.getServiceDependencies.
The service's mount point, relative to the database.
If set to true
, the result will only include each
dependency's current mount point. Otherwise it will include the full
definition for each dependency.
Note: When using ArangoDB 3.2.8 or older, setting the minimal
option
to true
avoids triggering a second request to fetch the full
dependency definitions.
Replaces the ArangoDB user's option with the new options.
Name of the ArangoDB user to modify.
New options to replace the user's existing options.
Return type to use. Defaults to the response object type.
Options for this request.
An optional function to transform the low-level response object to a more useful return value.
Returns a new Route instance for the given path (relative to the database) that can be used to perform arbitrary HTTP requests.
The database-relative URL of the route. Defaults to the database API root.
Default headers that should be sent with each request to the route.
Executes a service script and retrieves its result exposed as
module.exports
(if any).
The service's mount point, relative to the database.
Name of the service script to execute as defined in the service manifest.
Arbitrary value that will be exposed to the script as
argv[0]
in the service context (e.g. module.context.argv[0]
).
Must be serializable to JSON.
Runs the tests of a given service and returns the results using the "default" reporter.
The service's mount point, relative to the database.
Options for running the tests.
If set, only tests with full names including this exact string will be executed.
Whether the reporter should use "idiomatic" mode. Has no effect when using the "default" or "suite" reporters.
Runs the tests of a given service and returns the results using the "suite" reporter, which groups the test result by test suite.
The service's mount point, relative to the database.
Options for running the tests.
If set, only tests with full names including this exact string will be executed.
Whether the reporter should use "idiomatic" mode. Has no effect when using the "default" or "suite" reporters.
Runs the tests of a given service and returns the results using the "stream" reporter, which represents the results as a sequence of tuples representing events.
The service's mount point, relative to the database.
Options for running the tests.
If set, only tests with full names including this exact string will be executed.
Whether the reporter should use "idiomatic" mode. If set to true
,
the results will be returned as a formatted string.
Runs the tests of a given service and returns the results using the "tap" reporter, which represents the results as an array of strings using the "tap" format.
The service's mount point, relative to the database.
Options for running the tests.
If set, only tests with full names including this exact string will be executed.
Whether the reporter should use "idiomatic" mode. If set to true
,
the results will be returned as a formatted string.
Runs the tests of a given service and returns the results using the "xunit" reporter, which represents the results as an XML document using the JSONML exchange format.
The service's mount point, relative to the database.
Options for running the tests.
If set, only tests with full names including this exact string will be executed.
Whether the reporter should use "idiomatic" mode. If set to true
,
the results will be returned as a formatted string.
Runs the tests of a given service and returns the results as a string using the "stream" reporter in "idiomatic" mode, which represents the results as a line-delimited JSON stream of tuples representing events.
The service's mount point, relative to the database.
Options for running the tests.
If set, only tests with full names including this exact string will be executed.
Whether the reporter should use "idiomatic" mode. If set to false
,
the results will be returned as an array of tuples instead of a
string.
Runs the tests of a given service and returns the results as a string using the "tap" reporter in "idiomatic" mode, which represents the results using the "tap" format.
The service's mount point, relative to the database.
Options for running the tests.
If set, only tests with full names including this exact string will be executed.
Whether the reporter should use "idiomatic" mode. If set to false
,
the results will be returned as an array of strings instead of a
single string.
Runs the tests of a given service and returns the results as a string using the "xunit" reporter in "idiomatic" mode, which represents the results as an XML document.
The service's mount point, relative to the database.
Options for running the tests.
If set, only tests with full names including this exact string will be executed.
Whether the reporter should use "idiomatic" mode. If set to false
,
the results will be returned using the JSONML exchange format
instead of a string.
Sets the limit for the number of values of the most recently received server-reported queue times that can be accessed using Database.queueTime.
Number of values to maintain.
Enables or disables development mode for the given service.
The service's mount point, relative to the database.
Whether development mode should be enabled or disabled.
Sets the given ArangoDB user's access level for the database, or the given collection in the given database.
Name of the ArangoDB user to set the access level for.
Returns a Transaction instance for an existing streaming
transaction with the given id
.
See also Database.beginTransaction.
Fetches all active transactions from the database and returns an array of Transaction instances for those transactions.
See also Database.listTransactions.
Completely removes a service from the database.
The service's mount point, relative to the database.
Options for uninstalling the service.
Updates the configuration of the given service while maintaining any existing values for options not specified.
See also Database.replaceServiceConfiguration and Database.getServiceConfiguration.
The service's mount point, relative to the database.
An object mapping configuration option names to values.
If set to true
, the result will only include each
configuration option's current value and warning (if any).
Otherwise it will include the full definition for each option.
Note: When using ArangoDB 3.2.8 or older, setting the minimal
option
to true
avoids triggering a second request to fetch the full
configuration definitions.
Updates the configuration of the given service while maintaining any existing values for options not specified.
See also Database.replaceServiceConfiguration and Database.getServiceConfiguration.
The service's mount point, relative to the database.
An object mapping configuration option names to values.
If set to true
, the result will only include each
configuration option's current value and warning (if any).
Otherwise it will include the full definition for each option.
Note: When using ArangoDB 3.2.8 or older, setting the minimal
option
to true
avoids triggering a second request to fetch the full
configuration definitions.
Updates the dependencies of the given service while maintaining any existing mount points for dependencies not specified.
See also Database.replaceServiceDependencies and Database.getServiceDependencies.
The service's mount point, relative to the database.
If set to true
, the result will only include each
dependency's current mount point. Otherwise it will include the full
definition for each dependency.
Note: When using ArangoDB 3.2.8 or older, setting the minimal
option
to true
avoids triggering a second request to fetch the full
dependency definitions.
Updates the dependencies of the given service while maintaining any existing mount points for dependencies not specified.
See also Database.replaceServiceDependencies and Database.getServiceDependencies.
The service's mount point, relative to the database.
If set to true
, the result will only include each
dependency's current mount point. Otherwise it will include the full
definition for each dependency.
Note: When using ArangoDB 3.2.8 or older, setting the minimal
option
to true
avoids triggering a second request to fetch the full
dependency definitions.
Sets the password of a given ArangoDB user to the new value.
Name of the ArangoDB user to change the password for.
New password for the ArangoDB user.
Updates the ArangoDB user with the new options.
Name of the ArangoDB user to modify.
Options of the ArangoDB user to modify.
Replaces an existing service with a new service while retaining the old service's configuration and dependencies.
The service's mount point, relative to the database.
The service bundle to install.
Options for upgrading the service.
Updates the Database
instance's authorization
header to use Basic
authentication with the given username
and password
, then returns
itself.
The username to authenticate with.
The password to authenticate with.
Updates the Database
instance's authorization
header to use Bearer
authentication with the given authentication token
, then returns itself.
The token to authenticate with.
Updates the Database
instance and its connection string to use the given
databaseName
, then returns itself.
Note: This also affects all collections, cursors and other arangojs objects originating from this database object, which may cause unexpected results.
Name of the database to use.
Fetches all databases accessible to the active user from the server and
returns an array of Database
instances for those databases.
See also Database.listUserDatabases and Database.databases.
Fetches version information from the ArangoDB server.
If set to true
, additional information about the
ArangoDB server will be available as the details
property.
Returns an ArangoSearchView instance for the given viewName
.
Name of the ArangoSearch View.
Fetches all Views from the database and returns an array of ArangoSearchView instances for the Views.
See also Database.listViews.
Performs a request against every known coordinator and returns when the request has succeeded against every coordinator or the timeout is reached.
Note: This method is primarily intended to make database setup easier in cluster scenarios and requires all coordinators to be known to arangojs before the method is invoked. The method is not useful in single-server or leader-follower replication scenarios.
Request to perform against each known coordinator.
Maximum number of milliseconds to wait for propagation.
Generated using TypeDoc
An object representing a single ArangoDB database. All arangojs collections, cursors, analyzers and so on are linked to a
Database
object.