Run an FQL query.




The eval command runs the QUERY against the optional DBNAME database.

The query is executed in the child database. If you include a DBNAME, it must be the first argument.

The QUERY can be read from STDIN, a file, or the command line, and query results can be output to STDOUT or a file. You can also define the output format.

If you omit command line options, Fauna uses the configuration file options.

If the query returns an error, fauna-shell exits with a non-zero exit code.

You can’t use this command to execute a query in a parent or peer database. To access a database outside of the current database, log in to the Fauna Dashboard.


Argument Description


(Optional) Name of the child database the query should be run against.


Query you want to run.


Option Description


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


Optional output format. Must be one of:

  • json: A simple JSON format.

  • json-tagged: Tagged format. In v4, this flag behaves the same as the json flag.

  • shell: Decorated format. This is a JavaScript-based notation that is aware of Fauna data types.

The default is shell when output is to a terminal and json when piping to another command.


Enable type checking.


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


(Optional) Endpoint name to use for the command.


(Optional) Connection port.
Default = 8443


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


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


(Optional) connection timeout, in milliseconds. When the interval elapses, fauna-shell times out and displays an error.
Default = 5 seconds


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


The following examples illustrate the many ways to use the eval command.

QUERY argument

fauna eval "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: [
          status: "active"

QUERY file

The query in the file is identical to the previous example:

fauna eval --file=./query.fql

STDIN query

echo "Collection.all()" | fauna eval --stdin

Child database query

fauna eval my-test-db "Collection.all()"

When the child database doesn’t exist, a query of this type returns an error:

fauna eval nonexistdb "Collection.all()"

Output to a file

fauna eval Collection.all() --output=./output.json

Format the output in Fauna Shell format:

fauna eval Collection.all() --format=shell --output=./output.json

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!