shell

Start an interactive Fauna session to run queries.

Syntax

fauna shell [DBNAME] [OPTONS]

Description

The shell command starts an interactive query shell for sending Fauna database queries.

By default, this command supports FQL v10 queries. For FQL v4 queries, use the --version 4 option.

You can’t use this command to run queries against a parent or peer database. To access a database outside of the current database, log into the Fauna Dashboard instead.

Arguments

Argument Description

DBNAME

(Optional) Queries are executed against the DBNAME child database.

Options

Option Description

--file=<file>

(Optional) File to read the query or queries from.

--format=<format>

(Optional) Output format. One of:

  • json: (default when piping to another command) Simple JSON format.

  • json-tagged: Tagged format.

  • shell: (default when output is to a terminal) Decorated format, which is a JavaScript-based notation that is aware of Fauna data types.

--typecheck

Enable type checking.

--domain=<domain>

(Optional) Fauna server domain, which is the Fauna hostname.
Default = db.fauna.com

--endpoint=<name>

(Optional) Endpoint name to use for the command.

--port=<number>

(Optional) Connection port.
Default = 8443

--scheme=<scheme>

(Optional) Connection scheme. Must be one of:
       https (default)
       http

--secret=<secret>

(Optional) Secret to use to connect to a database.

--timeout=<integer>

(Optional) connection timeout, in milliseconds. When the interval elapses, fauna-shell times out and displays an error.
Default = 0, wait indefinitely until a response is received.

--version

(Optional) Fauna Query Language version
       v10 = (default) FQL v10
       v4 = FQL v4

Example

Start the shell and, at the prompt, list all of the database collections using the FQL Collection.all() method:

fauna shell
Connected to https://db.fauna.com:443
Type Ctrl+D or .exit to exit the shell
> Collection.all()
{
  data: [
    {
      name: "People",
      coll: Collection,
      ts: Time("2023-08-23T00:26:16.680Z"),
      indexes: {
        byEmail: {
          terms: [
            {
              field: "email"
            }
          ],
          queryable: true,
          status: "complete"
        }
      },
      constraints: [
        {
          unique: [
            "email"
          ],
          status: "active"
        }
      ]
    }
  ]
}
>

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!