eval
Runs the specified query.
fauna eval QUERY
Description
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.
Options
Option | Description |
---|---|
|
Optional - The Fauna server domain, that is, the hostname where
Fauna is running. Defaults to |
|
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 |
|
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, The default is zero, which means that |
|
Optional - The file to read the query (or queries) from. |
|
Optional - The output format. Must be one of:
The default is |
Examples
-
The following invocation shows running a query passed as an argument:
fauna eval "Paginate(Collections())" {"data":[{"@ref":{"id":"FirstCollection","collection":{"@ref":{"id":"collections"}}}}]}
-
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 {"data":[{"@ref":{"id":"FirstCollection","collection":{"@ref":{"id":"collections"}}}}]}
-
The following invocation shows passing a query via STDIN:
echo "Paginate(Collections())" | fauna eval --stdin {"data":[{"@ref":{"id":"FirstCollection","collection":{"@ref":{"id":"collections"}}}}]
-
The following invocation shows sending query output to a file:
fauna eval "Paginate(Collections())" --output=./output.json
cat ./output.json {"data":[{"@ref":{"id":"FirstCollection","collection":{"@ref":{"id":"collections"}}}}]
-
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!