JavaScript Modules

    The following global variables are available throughout ArangoDB and Foxx:

    • global
    • process
    • console
    • Buffer
    • __filename
    • __dirname

    ArangoDB supports a number of modules for compatibility with Node.js, including:

    • assert implements basic assertion and testing functions.

    • implements a binary data type for JavaScript.

    • console is a well known logging facility to all the JavaScript developers. ArangoDB implements most of the , with the exceptions of profile and count.

    • events implements an event emitter.

    • provides a file system API for the manipulation of paths, directories, files, links, and the construction of file streams. ArangoDB implements most Filesystem/A functions.

    • provides direct access to the module system.

    • path implements functions dealing with filenames and paths.

    • implements conversion functions for punycode encoding.

    • provides utilities for dealing with query strings.

    • stream provides a streaming interface.

    • implements logic for decoding buffers into strings.

    • url provides utilities for URL resolution and parsing.

    • provides general utility functions like format and inspect.

    Additionally ArangoDB provides partial implementations for the following modules:

    • net: only isIP, isIPv4 and isIPv6.

    • process: only env and cwd; stubs for , stdout.isTTY, stdout.write, nextTick.

    • tty: only isatty (always returns false).

    • vm: only .

    The following Node.js modules are not available at all:

    • child_process
    • cluster
    • constants
    • crypto (but see @arangodb/crypto below)
    • dgram
    • dns
    • domain
    • http (but see @arangodb/request below)
    • https
    • os
    • sys
    • tls
    • v8

    There are a large number of ArangoDB-specific modules using the @arangodb namespace, mostly for internal use by ArangoDB itself. The following modules noteworthy however and intended to be used by the user:

    • @arangodb provides direct access to the database and its collections.

    • provides an interface to manage ArangoSearch Analyzers.

    • AQL related modules:

      • @arangodb/aql/queries offers methods to track and kill AQL queries.

      • allows to control the AQL query caching feature.

      • @arangodb/aql/explainer provides methods to debug, explain and profile AQL queries.

      • provides an interface to (un-)register user-defined AQL functions.

    • @arangodb/crypto provides various cryptography functions including hashing algorithms.

    • Graph related modules:

      • implements a graph management interface for named graphs.

      • @arangodb/smart-graph provides management features for SmartGraphs

      • can load example graphs (creates collections, populates them with documents and creates named graphs)

    • @arangodb/replication is used for setting up and synchronizing data for Master/Slave replication.

    • implements task management methods

    • @arangodb/users provides an interface for user management.

    The following are preinstalled:

    • aqb is the ArangoDB Query Builder and can be used to construct AQL queries with a chaining JavaScript API.

    • is a full-featured assertion library for writing JavaScript tests.

    • dedent is a simple utility function for formatting multi-line strings.

    • parses stacktraces into a more useful format.

    • graphql-sync is an ArangoDB-compatible GraphQL server/schema implementation.

    • is an HTML syntax highlighter.

    • i (inflect) is a utility library for inflecting (e.g. pluralizing) words.

    • is a utility library for converting between character encodings

    • joi is a validation library that is supported throughout the Foxx framework.

    • is a JavaScript implementation of the YAML data format (a partial superset of JSON).

    • lodash is a utility belt for JavaScript providing various useful helper functions.

    • is a glob matcher for matching wildcards in file paths.

    • qs provides utilities for dealing with query strings using a different format than the querystring module.

    • is a utility library for handling semver version numbers.

    • sinon is a mocking library for writing test stubs, mocks and spies.