Runs the specified query.

fauna eval QUERY


The eval command runs the query that you specify. The query can be read from STDIN, a file, or the command line. The query results can be output to STDOUT or a file, and you can specify the output format.

If you don’t pass any options at the command line, Fauna uses the options specified in the fauna-shell configuration file.


Argument Description


The query that you want to execute.


Option Description


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


Optional - The name of the endpoint to use for the command.


Optional - The connection port. Defaults to 8443.


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


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


Optional - The connection timeout, an integer number of milliseconds. When the specified period 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.


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


Optional - The output format. Must be one of:

  • json: JSON format.

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

The default is json.


  1. The following invocation shows running a query passed as an argument:

    fauna eval "Paginate(Collections())"
  2. The following invocation shows running a query that exists in a file. The query in the file is identical to the previous example:

    fauna eval --file=./query.fql
  3. The following invocation shows passing a query via STDIN:

    echo "Paginate(Collections())" | fauna eval --stdin
  4. The following invocation shows sending query output to a file:

    fauna eval "Paginate(Collections())" --output=./output.json
    cat ./output.json
  5. The following invocation shows sending query output to a file in Fauna Shell format:

    fauna eval "Paginate(Collections())" --format=shell --output=./output.json
    cat ./output.json
    { data: [ Collection("FirstCollection") ] }

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!