Instructor: Fauna's native API for querying is called the Fauna Query Language, or FQL. While FQL can't be used for general purpose programming, it is based on a Lambda calculus and is expression-oriented. That means everything returns a value.
Notably, pre-execution for FQL is transactional. No changes are committed if something goes wrong. If a query fails, all you get is an error response. This is part of FaunaDB's consistency model.
FQL can be used in the shell or through a number of client drivers. Each of the drivers will implement FQL slightly differently, so be sure to check the documentation for your language of choice. The data types in FQL extend the JSON data format. All of JSON's data types are supported, including NULL.
In addition to the JSON types that you're probably used to, there are a number of special types that FQLX adds. These include byte, date, ref, set, and timestamp. We'll be dealing with refs quite often. This is how we access documents or sets of documents.
One more data type that is less a data type and more an object is an event. An event is a specially structured object that is used to represent all of the events that have happened to a particular document, such as create, update, and delete.
Since everything in FQL returns a value, functions are very important. Here, we can see an overview of various data types and use cases and the functions in those collections. This includes functions you may be used to, like Map, as well as functions you may be less used to, like At, which retrieves a document at or before a particular point in time.
This is related to the temporal querying aspect on a DB. Here, we are at the FaunaDB shell, where we'll use FQL to make our first query. Note that when we match on the index all customers, we get a setback. Note, also, that because index returns the value, we can pass that value to match. This is how we'll compose all of our expressions.
If we look at the return value for index, we can see that it returns a ref. If we look at match, we can see that it takes an index ref and a set of search terms. We happened to not use the search terms this time, so we'll return all of the documents in the index as a set ref.