mirror of https://gitee.com/bigwinds/arangodb
57 lines
2.2 KiB
Plaintext
57 lines
2.2 KiB
Plaintext
!CHAPTER ArangoDB Shell Introduction
|
|
|
|
The ArangoDB shell (_arangosh_) is a command-line tool that can be used for
|
|
administration of ArangoDB, including running ad-hoc queries.
|
|
|
|
The _arangosh_ binary is shipped with ArangoDB and can be invoked like so:
|
|
|
|
```
|
|
unix> arangosh
|
|
```
|
|
|
|
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 <string>*: name of the database to connect to
|
|
* *--server.endpoint <string>*: endpoint to connect to
|
|
* *--server.username <string>*: database username
|
|
* *--server.password <string>*: password to use when connecting
|
|
* *--server.disable-authentication <bool>*: disable password prompt and authentication
|
|
|
|
For example, to connect to an ArangoDB server on IP *192.168.173.13* on port
|
|
8530 with the user *foo* and using the database *test*, use:
|
|
|
|
unix> arangosh \
|
|
--server.endpoint tcp://192.168.173.13:8530 \
|
|
--server.username foo \
|
|
--server.database test \
|
|
--server.disable-authentication false
|
|
|
|
_arangosh_ will then display a password prompt and try to connect to the
|
|
server after the password was entered.
|
|
|
|
To change the current database after the connection has been made, you
|
|
can use the `db._useDatabase()` command in arangosh:
|
|
|
|
arangosh> db._useDatabase("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.
|
|
|
|
By the way, _arangosh_ provides the *db* object by default, and this object can
|
|
be used for switching to a different database and managing collections inside the
|
|
current database.
|
|
|
|
For a list of available methods for the *db* object, type
|
|
|
|
arangosh> db._help();
|
|
|