create-database

Create a child database in the current database.

Syntax

fauna create-database DBNAME [OPTIONS]

Description

The create-database command creates a child database in the current database, with the name that you specify. If you don’t pass any options at the command line, Fauna uses the default options in the fauna-shell configuration file.

Is not possible to use this command to create a parent or peer database. To create a database outside of the current database, use the Fauna Dashboard.

Arguments

Argument Description

DBNAME

The name of the child database that you are creating.

Options

Option Description

--domain=<domain>

Optional Fauna server domain, that is, the hostname where Fauna is running. Defaults to db.fauna.com.

--endpoint=<name>

Optional name of the endpoint to use for the command.

--port=<number>

Optional connection port. Defaults to 8443.

--scheme=<scheme>

Optional connection scheme. Must be one of https or http. Defaults to https.

--secret=<secret>

Optional secret to use. A secret authenticates your connection to Fauna, and connects you to a database.

--timeout=<integer>

Optional connection timeout, an integer number of milliseconds. When the interval has elapsed, fauna-shell stops waiting for a response and displays an error.

The default is zero, which means that fauna-shell waits until a response is received.

Examples

Create a database called my-test-db:

$ fauna create-database my-test-db
creating database my-test-db

  created database 'my-test-db'

  To start a shell with your new database, run:

  fauna shell 'my-test-db'

  Or, to create an application key for your database, run:

  fauna create-key 'my-test-db'

Now, when you run fauna shell and query for a list of databases, you can see that the child database production is listed:

$ fauna shell
Connected to https://db.fauna.com:443
Type Ctrl+D or .exit to exit the shell
> Database.all()
{
  data: [
    {
      name: "my-test-db",
      coll: Database,
      ts: Time("2023-08-30T21:42:29.200Z"),
      global_id: "yw3jf8si4yrrn"
    }
  ]
}

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!