fauna shell
Start an interactive Fauna session to run queries.
Syntax
fauna shell [<DB_PATH>] [--endpoint <value>] [--environment <value>]
[--file <value>] [--format json|json-tagged|shell] [--output <value>]
[--secret <value>] [--stdin] [--timeout <value>] [--typecheck]
[--url <value>] [--version 4|10]
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.
FQL v4 access
Fauna accounts created after August 21, 2024 can’t use |
You can’t use this command to run queries against a parent or peer database.
Options
Option | Description |
---|---|
|
Connection endpoint from |
|
Environment to use, from a Fauna project. |
|
Name of file with queries to run. |
|
Output format: |
|
Help for |
|
File to write output to. |
|
Authentication secret. Overrides the
secret in Use a scoped key to interact with a child database using a parent database’s admin key. For example, with a parent database’s admin key secret of |
|
Read file input from stdin. Write to stdout by default. |
|
Connection timeout (milliseconds). |
|
Enable typechecking. |
|
Database URL. Overrides the URL in |
|
FQL Version: See FQL v4 access. |
Example
Start the shell:
fauna shell
At the prompt, run a query to list all collections using the FQL
Collection.all()
method:
Collection.all()
{
data: [
{
name: "Customer",
coll: Collection,
ts: Time("2099-07-30T22:22:32.945Z"),
constraints: [
{
unique: [
{
field: ".email",
mva: false
}
],
status: "active"
}
],
fields: {
name: {
signature: "String"
},
email: {
signature: "String"
},
address: {
signature: "{ street: String, city: String, state: String, postalCode: String, country: String }"
}
},
history_days: 0,
indexes: {
byEmail: {
terms: [
{
field: ".email",
mva: false
}
],
queryable: true,
status: "complete"
}
},
computed_fields: {
cart: {
body: "(customer) => Order.byCustomerAndStatus(customer, \"cart\").first()",
signature: "Order?"
},
orders: {
body: "(customer) => Order.byCustomer(customer)",
signature: "Set<Order>"
}
}
},
...
]
}
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!