# `Arangox.API.Databases`
[🔗](https://github.com/ArangoDB-Community/arangox/blob/v0.8.0/lib/arangox/api/databases.ex#L1)

ArangoDB's Databases operations.

Every function takes the pool as its first argument and returns the decoded
response body. See `Arangox.API.Client` for the options they all accept and
for what a `404` returns.

# `all`

```elixir
@spec all(
  Arangox.conn(),
  keyword()
) :: {:ok, term()} | {:error, Exception.t()}
```

List all databases

Retrieves the list of all existing databases

> **INFO:**
Retrieving the list of databases is only possible from within the `_system` database.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => [string]
    }

# `all!`

```elixir
@spec all!(
  Arangox.conn(),
  keyword()
) :: term()
```

List all databases. Raises on error.

See `all/1`.

# `all_user_accessible`

```elixir
@spec all_user_accessible(
  Arangox.conn(),
  keyword()
) :: {:ok, term()} | {:error, Exception.t()}
```

List the accessible databases

Retrieves the list of all databases the current user can access without
specifying a different username or password.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => [string]
    }

# `all_user_accessible!`

```elixir
@spec all_user_accessible!(
  Arangox.conn(),
  keyword()
) :: term()
```

List the accessible databases. Raises on error.

See `all_user_accessible/1`.

# `create`

```elixir
@spec create(Arangox.conn(), term(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Create a database

Creates a new database.

The response is a JSON object with the attribute `result` set to `true`.

> **INFO:**
Creating a new database is only possible from within the `_system` database.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => boolean
    }

# `create!`

```elixir
@spec create!(Arangox.conn(), term(), keyword()) :: term()
```

Create a database. Raises on error.

See `create/2`.

# `current`

```elixir
@spec current(
  Arangox.conn(),
  keyword()
) :: {:ok, term()} | {:error, Exception.t()}
```

Get information about the current database

Retrieves the properties of the current database

The response is a JSON object with the following attributes:

- `name`: the name of the current database
- `id`: the id of the current database
- `path`: the filesystem path of the current database
- `isSystem`: whether or not the current database is the `_system` database
- `sharding`: the default sharding method for collections created in this database
- `replicationFactor`: the default replication factor for collections in this database
- `writeConcern`: the default write concern for collections in this database

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => %{
        "id" => string,
        "isSystem" => boolean,
        "name" => string,
        "path" => string
      }
    }

# `current!`

```elixir
@spec current!(
  Arangox.conn(),
  keyword()
) :: term()
```

Get information about the current database. Raises on error.

See `current/1`.

# `delete`

```elixir
@spec delete(Arangox.conn(), binary(), keyword()) ::
  {:ok, term()} | {:error, Exception.t()}
```

Drop a database

Drops the database along with all data stored in it.

> **INFO:**
Dropping a database is only possible from within the `_system` database.
The `_system` database itself cannot be dropped.

## Returns

Recorded against ArangoDB 3.12.10:

    %{
      "code" => integer,
      "error" => boolean,
      "result" => boolean
    }

# `delete!`

```elixir
@spec delete!(Arangox.conn(), binary(), keyword()) :: term()
```

Drop a database. Raises on error.

See `delete/2`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
