Arangosh Examples

By default arangosh will try to connect to an ArangoDB server running on server localhost on port 8529. It will use the username root and an empty password by default. Additionally it will connect to the default database (_system). All these defaults can be changed using the following command-line options:

  • --server.database : name of the database to connect to
  • --server.endpoint : endpoint to connect to
  • --server.username : database username
  • --server.password : password to use when connecting
  • --server.authentication : whether or not to use authentication

For example, to connect to an ArangoDB server on IP on port 8530 with the user foo and using the database test, use:

arangosh --server.endpoint tcp:// --server.username foo --server.database test --server.authentication true

arangosh will then display a password prompt and try to connect to the server after the password was entered.

The shell will print its own version number and if successfully connected to a server the version number of the ArangoDB server.

To change the current database after the connection has been made, you can use the db._useDatabase() command in Arangosh:

arangosh> db._createDatabase("myapp");
arangosh> db._useDatabase("myapp");
arangosh> db._useDatabase("_system");
arangosh> db._dropDatabase("myapp");

To get a list of available commands, Arangosh provides a help() function. Calling it will display helpful information.

arangosh also provides auto-completion. Additional information on available commands and methods is thus provided by typing the first few letters of a variable and then pressing the tab key. It is recommend to try this with entering db. (without pressing return) and then pressing tab.