Cookbook
The cookbook section of the Fauna documentation includes task-oriented information organized by functional area to quickly gain an understanding of how to develop applications with Fauna.
Follow these how-tos for a learning experience that walks you through practical, hands-on exercises covering key Fauna concepts and techniques. Cookbooks are organized as a graduated set of recipes, progressing from the most common or basic operations, to more advanced tasks. You can start in the cookbook with the tutorial that matches your experience level.
The associated reference documentation for these cookbooks is found in the Reference section.
What you’ll find here
- FQL language and API
-
This cookbook takes you through hands-on tutorials that provide the foundational Fauna Query Language (FQL) language knowledge needed to develop a Fauna application.
- Manage schema
-
This cookbook introduces you to the Fauna Schema Language (FSL). Using configuration and schema files to define your projects and database schema, you can easily make updates to your environment and schema and reliably share those updates.
- Access control
-
This cookbook shows you how to set up and manage access control to authentication with a Fauna database and get authorization to act on database resources.
How to use the cookbook
This cookbook provides a progressive, hands-on experience that facilitates learning Fauna, FQL, and FSL. Each tutorial builds on what you learned in previous tutorials.
After setting up your environment and verifying that you can successfully make queries, progress through the tutorials sequentially, or jump to the topic you’re currently interested in or that matches your experience level with Fauna.
When trying the examples in the Shell, ensure type checking is enabled.
The examples assume a given database setup, so fields with values set at
creation time, such as id
and ts
, might differ in the documentation from
the values you see. Where applicable, replace the values in the examples with
your actual values.
The FQL language reference and FQL API reference sections are references for finding more detailed information about the operations and interfaces used in the cookbook examples. |
Environment setup for running the examples
The easiest way to try the examples as you follow the tutorials is to use the Dashboard. If you’ve already tried the Quick start, you’re already set up to run the examples.
Because the FQL syntax is the same in all contexts, you can also run the same examples programmatically using one of the Client drivers for your language of choice.
Notes on error handling
As you progress through the tutorials and try examples, you might encounter error responses from Fauna. Errors can be caused by typos or other issues, but the error messages can help with debugging the error so you can continue with the exercises.
For example, when type checking is enabled, an error is raised by the following example because the non-null assertion postfix operator is omitted:
invalid_query
error: Type `Null` does not have field `update`
at *query*:3:9
|
3 | product.update(
| ^^^^^^
|
hint: Use the ! or ?. operator to handle the null case
|
3 | product!.update(
| +
|
Notice that the error message indicates the location of the error, which should help in finding the cause.
If you’re unable to find the cause of the error or find that the documentation provides insufficient guidance, email docs@fauna.com with a description of the error.
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!