Learn

This section of the Fauna documentation includes conceptual content essential to understanding how to work with Fauna and develop database applications.

What you’ll find here

Data model

This section of the Fauna documentation describes the schema naming and taxonomy of the data model and the structural and behavioral components of the model.

FQL basics cookbook

Follow these how-tos for a learning experience that walks you through practical, hands-on familiarization with key Fauna concepts and techniques. The cookbook is organized as a graduated set of recipes, progressing from setting up and validating your environment, through the most common or basic operations, to more advanced tasks. You can start in the cookbook with the tutorial that matches your level of experience.

Access control cookbook

This section describes the Fauna authentication and authorization capabilities.

About FQL

FQL is designed to support relational features such as foreign keys, views, and joins with the ability to express declarative queries and functional business logic in transactions optimized for performance and consistency. This makes FQL ideal for interactive applications, IoT services, edge computing, and other operational use cases.

Notes on the syntax

FQL features a TypeScript-inspired syntax, which is extended to support concise relational queries and is, optionally, statically typed. This gives you a developer language that empowers you to write clear, concise queries and transactional code. A TypeScript-inspired database language is purpose-fit for Fauna. The resulting FQL syntax is familiar and easy to learn and scales to handle complex business logic, making it easy to realize the power of the Fauna operational database architecture.

Unlike well-known relational query languages, which are keyword-heavy and require learning a new syntax for every feature, FQL has a small core syntax with dedicated shorthand for common query concepts, such as record predicates and projection. Querying, data manipulation, and other capabilities are exposed as APIs on top of the core syntax. This gives you an easy-to-learn language with a rich feature set that remains discoverable over time.

Collections of documents

Collections expose an ORM-like API for creating declarative queries, with composable methods for filtering, ordering, and transforming sets of documents as part of core FQL. The core API is enhanced with dedicated syntax to optimize the readability of predicates and projection/transformation.

Working with documents is as simple as reading fields off objects. FQL support for first-class foreign keys simplifies them by dereferencing documents through associated fields. For example, if a book document has an author stored in an author field, the author document is retrieved transparently through field access.

FQL includes a powerful indexing system that enables an iterative approach to developer-driven query optimization.

These capabilities mean that it is easy to build sophisticated join-like queries that remain easy to work with as they scale in complexity, and queries can be tailored to return the exact data the application requires.

Portability

Occasionally, you might want to port a query from one context to another, such as interactively developing the query in the dashboard shell and copying it to your application code or applying your FQL knowledge in a different host programming environment. FQL has a dedicated syntax that applies to all contexts in which it exists, with drivers that implement a secure, string-based template system for embedded queries. This means that you can apply the same query syntax everywhere.

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!