Fauna Query Language (FQL)

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

Fauna Query Language (FQL)

The Fauna Query Language (FQL) is the native API for querying Fauna. This section provides reference documentation for FQL’s data types and functions.

While not a general-purpose programming language, it provides much of the functionality expected from one. It allows for complex, precise manipulation and retrieval of data stored within Fauna.

The language is expression-oriented: all functions, control structures, and Literal return values. So it is easy, for example, to group multiple results together by combining them into an Array or Object, or map over a collection and compute a result—​possibly fetching more data—​for each member.

FQL operates primarily on the schema types provided by Fauna, which include documents, collections, indexes, sets, and databases.

A query is executed by submitting it to Fauna, which computes and returns the result. Query execution is transactional: No changes are committed if something goes wrong. If a query fails, an error response is returned instead of a result.

FQL syntax varies with each supported language, as each language-specific driver provides an API that embeds itself into the host language, to make it easier to include local data structures in queries, and for processing query results.

When there are language-specific alternatives for the example queries, use the language switcher at the top of the page to view queries and responses in the selected language.