# Overview Fauna is a truly serverless database that combines document flexibility with native relational capabilities, offering auto-scaling, multi-active replication, and HTTPS connectivity. ## [](#key-concepts-and-features)Key concepts and features ### [](#relational-model)Relational model Fauna’s data model integrates the best aspects of document and relational databases. Like other document databases, data is stored in JSON-like documents, allowing for the storage of unstructured data and removing the need for an object-relational mapper (ORM) to translate between objects and tables. Fauna also provides key features of relational databases including strong consistency, first-class support for relationships between documents, and the ability to layer on and enforce schema over time. [Documents](../../learn/data-model/documents/) in Fauna are organized into [collections](../../learn/data-model/collections/), similar to tables in relational databases, providing a familiar structure for data organization. Collections can specify [document types](../../learn/schema/#document-type-definitions), which define and enforce the structure of documents they contain. This feature allows developers to start with a [flexible schema](../../learn/schema/#type-enforcement) and gradually introduce more structure as their application matures. Importantly, Fauna supports [relationships between documents](../../learn/data-model/relationships/) in different collections, enabling complex data modeling without duplicating data. This approach combines the ease of use of document databases with the powerful data modeling capabilities of relational systems. ### [](#distributed-architecture)Distributed architecture Fauna is built on a distributed architecture that offers global data distribution across multiple regions. It provides strong consistency for all transactions, even across geographic regions, a feature that sets Fauna apart from many other distributed databases. ### [](#fauna-query-language)Fauna Query Language [Fauna Query Language (FQL)](../../learn/query/) is a TypeScript-inspired language designed specifically for querying and manipulating data in Fauna. It offers a concise, yet expressive syntax for relational queries, supporting complex joins and data transformations. FQL includes optional static typing to catch errors early in development, improving code quality and reducing runtime issues. One of FQL’s powerful features is the ability to create [user-defined functions (UDFs)](../../learn/schema/user-defined-functions/). These allow developers to encapsulate complex business logic directly within the database, promoting code reuse and maintaining a clear separation of concerns. Here’s an example of an FQL query: ```fql // Gets the first customer with // an email of "alice.appleseed@example.com". let customer = Customer.where(.email == "alice.appleseed@example.com") .first() // Gets the first order for the customer, // sorted by descending creation time. Order.where(.customer == customer) .order(desc(.createdAt)). first() { // Project fields from the order. // The order contains fields with document references. // Projecting the fields resolves references, // similar to a SQL join. // `Customer` document reference: customer { name, email }, status, createdAt, items { // Nested `Product` document reference: product { name, price, stock, // `Category` document reference: category { name } }, quantity }, total } ``` The query shows how FQL can succinctly express complex operations, including lookups, joins, sorting, and data projection. ### [](#fauna-schema-language)Fauna Schema Language [Fauna Schema Language (FSL)](../../learn/schema/) allows developers to define and manage database schema as code. It enables version control for schema changes, [integration with CI/CD pipelines](../../learn/schema/manage-schema/#cicd), and [progressive schema enforcement](../../learn/schema/#type-enforcement) as applications evolve. By treating database schema as code, teams can apply the same rigorous review and testing processes to database changes as they do to application code. Here’s an example of an FSL schema definition: ```fsl collection Customer { name: String email: String address: { street: String city: String state: String postalCode: String country: String } compute cart: Order? = (customer => Order.byCustomerAndStatus(customer, 'cart').first()) // Use a computed field to get the Set of Orders for a customer. compute orders: Set = ( customer => Order.byCustomer(customer)) // Use a unique constraint to ensure no two customers have the same email. unique [.email] index byEmail { terms [.email] } } ``` This schema defines a `Customer` collection with specific fields, a computed field, a uniqueness constraint, and an index. The `*: Any` [wildcard constraint](../../learn/schema/#wildcard-constraint) allows for arbitrary ad hoc fields, providing flexibility while still enforcing structure where needed. ### [](#transactions-and-consistency)Transactions and consistency In Fauna, every query is a transaction, ensuring ACID compliance across all operations, even in globally distributed region groups. Fauna’s distributed transaction engine, based on the Calvin protocol, provides strict serializability for all read-write queries and serializable isolation for read-only queries. This guarantees real-time consistency across all replicas without relying on clock synchronization, eliminating anomalies common in systems dependent on synchronized clocks. Fauna’s strong consistency model has been verified by Jepsen, an independent third-party analysis firm, confirming its ability to maintain high levels of consistency even under various failure scenarios. Despite these robust guarantees, Fauna maintains high performance and low latency, even for geographically distributed deployments, thanks to its innovative architecture that separates transaction ordering from execution. ### [](#security-and-access-control)Security and access control Fauna provides comprehensive security features to protect your data and control access. It offers [role-based access control (RBAC)](../../learn/security/roles/) for coarse-grained permissions and [attribute-based access control (ABAC)](../../learn/security/abac/) for fine-grained, dynamic access rules. This combination allows for highly flexible and precise control over who can access and modify data. The system includes [built-in user authentication](../../learn/security/authentication/) and also supports integration with [third-party identity providers](../../learn/security/authentication/), allowing you to use existing authentication systems. All data in Fauna is encrypted at rest and in transit, ensuring protection at all times. ### [](#change-data-capture-cdc-and-real-time-events)Change data capture (CDC) and real-time events Fauna’s [Change data capture (CDC)](../../learn/cdc/) feature enables real-time application features. Developers can subscribe to changes in collections or specific documents, receiving either atomic push updates using real-time [event streams](../../learn/cdc/) or on-demand batch pull updates using [event feeds](../../learn/cdc/) . Events are particularly useful for maintaining live application states, building collaborative features that require real-time synchronization, and mirroring changes into external systems. ### [](#database-model)Database model Fauna’s [database model](../../learn/data-model/databases/) makes it easy to create databases for isolated environments, such as staging and production, and build secure multi-tenant applications. For multi-tenant applications, developers can create isolated child databases for each tenant, applying separate access controls and schema as needed. The same approach can be applied to isolated environments, enabling separate databases for each environment, ensuring that changes in one environment do not affect others. This model simplifies administration, ensures clear separation between environments, and guarantees that tenants or environments cannot interfere with each other’s data. ## [](#developer-experience)Developer experience Fauna is designed to integrate seamlessly into modern development workflows. It provides official [client drivers](../../build/drivers/) for popular programming languages such as JavaScript, Python, Go, Java, and C#. The [Fauna CLI](../../build/cli/v4/) offers tools for schema management and database operations, while the Dashboard enables visual database management and query execution. Additionally, the [Fauna container image](../../build/tools/docker/) can be used for local testing and validation, even in environments where connectivity is limited. By supporting schema-as-code practices and CI/CD integration, Fauna allows development teams to treat database changes with the same rigor as application code changes. This approach promotes better collaboration, easier testing, and more reliable deployments. ## [](#comparison-to-other-databases)Comparison to other databases While Fauna shares some characteristics with both document and relational databases, it offers unique capabilities that set it apart. ### [](#document-databases-example-mongodb)Document databases (Example: MongoDB) Fauna and MongoDB are both document databases, but Fauna offers a unique combination of document flexibility with relational database features. While MongoDB provides a flexible document model and horizontal scalability, Fauna enhances this with strong consistency guarantees, built-in support for complex relationships, and more powerful querying capabilities through FQL. Fauna’s document model allows for enforcing schema when needed, supporting complex joins, and maintaining ACID compliance across distributed environments. Unlike MongoDB, Fauna provides native multi-region distribution and doesn’t require separate replication setup or sharding configurations. | See Fauna for MongoDB users | | --- | --- | --- | ### [](#key-value-stores-example-dynamodb)Key-value stores (Example: DynamoDB) Compared to key-value stores like DynamoDB, Fauna offers a richer data model and query capabilities while maintaining high performance and scalability. Fauna’s document model allows for more complex data structures and relationships, reducing the need for denormalization often required in DynamoDB. Fauna provides native support for secondary indexes without the limitations found in DynamoDB, such as the ability to index nested fields and arrays. Additionally, Fauna’s query language (FQL) allows for more sophisticated queries and data manipulations within the database, potentially reducing application-side complexity. Both databases offer serverless operations, but Fauna’s multi-region distribution is built-in, simplifying global deployment. ### [](#traditional-relational-databases-example-postgresql)Traditional relational databases (Example: PostgreSQL) While both Fauna and PostgreSQL are relational databases supporting ACID transactions, their architectures and deployment models differ significantly. PostgreSQL follows a traditional client-server model with a fixed schema, while Fauna offers a flexible document model with optional schema enforcement. Fauna’s serverless, globally distributed architecture contrasts with PostgreSQL’s typical single-region deployment, offering easier scalability and global distribution out of the box. Fauna’s FQL provides a modern, programmable query interface, whereas PostgreSQL uses standard SQL. Both support stored procedures, but Fauna’s User-Defined Functions (UDFs) are written in FQL and executed within the database’s distributed environment. Fauna also offers built-in temporality and multi-tenancy features, which typically require additional setup in PostgreSQL. | See Fauna for SQL users | | --- | --- | --- | ### [](#newsql-databases-example-cockroachdb)NewSQL databases (Example: CockroachDB) Fauna and NewSQL databases like CockroachDB both aim to combine the scalability of NoSQL systems with the strong consistency of traditional relational databases. However, Fauna’s approach differs in its serverless, API-first design. While CockroachDB focuses on providing a distributed SQL database, Fauna offers a relational document model with its own query language (FQL). Fauna’s built-in multi-tenancy and attribute-based access control provide more granular security options out of the box. Both databases offer global distribution, but Fauna’s serverless nature means users don’t need to manage nodes or worry about data placement strategies. Fauna’s [temporal query](../../learn/doc-history/#temporal-query) capabilities and [event feeds and event streams](../../learn/cdc/) are also notable features not typically found in NewSQL offerings. ### [](#summary)Summary With this combined set of features, Fauna aims to provide a unified solution that meets the diverse needs of modern application development, from rapid prototyping to global-scale production deployments. Its unique approach allows developers to build sophisticated, globally distributed applications without the operational complexity traditionally associated with such systems. # CRUD and basic operations This page contains examples of CRUD queries and other common database operations in Fauna Query Language (FQL) and Fauna Schema Language (FSL). ## [](#collections)Collections ### [](#create-a-collection)Create a collection To create a collection, add an FSL [collection schema](../../../../reference/fsl/collection/) to Fauna using a [staged schema change](../../../schema/manage-schema/#staged). ```fsl // Defines the `Customer` collection. collection Customer { // Field definitions. // Define the structure of the collection's documents. name: String email: String address: { street: String city: String state: String postalCode: String country: String } // Wildcard constraint. // Allows arbitrary ad hoc fields of any type. *: Any // If a collection schema has no field definitions // and no wildcard constraint, it has an implicit // wildcard constraint of `*: Any`. } ``` | See Schema | | --- | --- | --- | ### [](#edit-a-collection)Edit a collection Update a collection’s document type using a [zero-downtime schema migration](../../../schema/#schema-migrations): ```fsl collection Customer { name: String email: String address: { street: String city: String state: String postalCode: String country: String } // Adds the `points` field. Accepts `int` or `null` values. // Accepting `null` means the field is not required. points: Int? // Adds the `typeConflicts` field as a catch-all field for // existing `points` values that aren't `Int` or `null`. typeConflicts: { *: Any }? *: Any migrations { // Adds the `typeConflicts` field. add .typeConflicts // Adds the `points` field. add .points // Nests non-conforming `points` and `typeConflicts` // field values in the `typeConflicts` catch-all field. move_conflicts .typeConflicts } } ``` | See Schema migrations | | --- | --- | --- | ### [](#view-collections)View collections ```fql Collection.all() ``` | Reference: Collection.all() | | --- | --- | --- | ### [](#delete-a-collection)Delete a collection To delete a collection, delete its schema using any of the following: * The [Fauna CLI](../../../schema/manage-schema/#staged) * The [Fauna Dashboard](https://dashboard.fauna.com/) * The Fauna Core HTTP API’s [Schema endpoints](../../../../reference/http/reference/core-api/#tag/Schema) * The FQL [`collectionDef.delete()`](../../../../reference/fql-api/collection/delete/) method. Deleting a collection deletes its documents and indexes. ## [](#documents)Documents ### [](#create-a-document)Create a document ```fql // Creates a `Customer` collection document. Customer.create({ name: "John Doe", email: "john.doe@example.com", address: { street: "123 Main St", city: "San Francisco", state: "CA", postalCode: "12345", country: "United States" } }) ``` | Reference: collection.create() | | --- | --- | --- | ### [](#get-a-single-document)Get a single document ```fql // Gets a `Customer` collection document. // Replace `111` with a document `id`. Customer.byId("111") ``` | Reference: collection.byId() | | --- | --- | --- | ### [](#update-a-document)Update a document ```fql // Updates a `Customer` collection document. Customer.byId("111")?.update({ // Updates the existing `name` field value. name: "Jonathan Doe", // Adds new `points` field. points: 42 }) ``` | Reference: document.update() | | --- | --- | --- | ### [](#upsert-a-document)Upsert a document ```fql // Try to find an existing customer. // If the customer doesn't exist, returns `null`. let customer = Customer.byId("111") // Customer data to upsert let data = { name: "Alice Appleseed", email: "alice.appleseed@example.com", address: { street: "87856 Mendota Court", city: "Washington", state: "DC", postalCode: "20220", country: "US" } } // Create or update the customer // based on existence. if (customer == null) { Customer.create(data) } else { customer!.update(data) } ``` ### [](#remove-a-document-field)Remove a document field ```fql // Updates a `Customer` collection document. Customer.byId("111")?.update({ // Removes the `points` field. points: null }) ``` | Reference: document.update() | | --- | --- | --- | ### [](#replace-a-document)Replace a document ```fql // Replaces a `Customer` collection document. Customer.byId("111")?.replace({ name: "Jane Doe", email: "jane.doe@example.com", address: { street: "87856 Mendota Court", city: "Washington", state: "DC", postalCode: "20220", country: "US" } }) ``` | Reference: document.replace() | | --- | --- | --- | ### [](#delete-a-document)Delete a document ```fql // Deletes a `Customer` collection document. Customer.byId("111")?.delete() ``` | Reference: document.delete() | | --- | --- | --- | ### [](#bulk-writes)Bulk writes Use [`set.forEach()`](../../../../reference/fql-api/set/foreach/) to iteratively update each document in a Set: ```fql // Get a Set of `Customer` collection documents with an // `address` in the `state` of `DC`. let customers = Customer.where(.address?.state == "DC") // Use `forEach()` to update each document in the previous Set. customers.forEach(doc => doc.update({ address: { street: doc?.address?.street, city: doc?.address?.city, state: "District of Columbia", postalCode: doc?.address?.postalCode, country: doc?.address?.country, } })) // `forEach()` returns `null`. ``` For more examples, see [Bulk writes](../bulk-writes/). | Reference: set.forEach() | | --- | --- | --- | ## [](#indexes-and-reads)Indexes and reads ### [](#create-an-index)Create an index You define indexes in FSL as part of a [collection schema](../../../../reference/fsl/collection/): ```fsl collection Customer { ... index byEmail { // `terms` are document fields for exact match searches. // In this example, you get `Customer` collection documents // by their `email` field value. terms [.email] // `values` are document fields for sorting and range searches. // In this example, you sort or filter index results by their // descending `name` and `email` field values. values [.name, .email] } } ``` | See Define an index | | --- | --- | --- | ### [](#exact-match-search)Exact match search ```fql // Runs an unindexed query. Customer.where(.email == "alice.appleseed@example.com") ``` For better performance on large datasets, use an index with a term to run an [exact match search](../../../data-model/indexes/#terms). Define the index in the collection schema: ```fsl collection Customer { ... // Defines the `byEmail()` index for the `Customer` // collection. index byEmail { // Includes the `email` field as an index term. terms [.email] values [.name, .email] } } ``` You call an index as a method on its collection: ```fql // Uses the `Customer` collection's `byEmail()` index // to run an exact match search on an `email` field value. Customer.byEmail("alice.appleseed@example.com") ``` | See Run an exact match search | | --- | --- | --- | ### [](#sort-collection-documents)Sort collection documents ```fql // Runs an unindexed query. // Sorts `Product` collection documents by: // - `price` (ascending), then ... // - `name` (ascending), then ... // - `description` (ascending), then ... // - `stock` (ascending). Product.all().order(.price, .name, .description, .stock) ``` For better performance on large datasets, use an index with values to [sort collection documents](../../../data-model/indexes/#sort-documents). Define the index in the collection schema: ```fsl collection Product { ... // Defines the `sortedByPriceLowToHigh()` index. index sortedByPriceLowToHigh { // `values` are document fields for sorting and range searches. values [.price, .name, .description, .stock] } } ``` Call the index in a query: ```fql // Uses the `Product` collection's `sortedByPriceLowToHigh()` index // to sort `Product` collection documents by: // - `price` (ascending), then ... // - `name` (ascending), then ... // - `description` (ascending), then ... // - `stock` (ascending). Product.sortedByPriceLowToHigh() ``` | See Sort collection documents | | --- | --- | --- | ### [](#range-search)Range search ```fql // Runs an unindexed query. // Get `Product` collection documents with a `price` between // 10_00 and 100_00 (inclusive). Product.where(.price >= 10_00 && .price <= 100_00) .order(.price, .name, .description, .stock) ``` For better performance on large datasets, use an index with values to run [range searches](../../../data-model/indexes/#range-search) on collection documents, Define the index in the collection schema: ```fsl collection Product { ... // Defines the `sortedByPriceLowToHigh()` index. index sortedByPriceLowToHigh { // `values` are document fields for sorting and range searches. values [.price, .name, .description, .stock] } } ``` Call the index in a query: ```fql // Get `Product` collection documents with a `price` between // 10_00 and 100_00 (inclusive). Product.sortedByPriceLowToHigh({ from: 10_00, to: 100_00 }) ``` | See Run a range search | | --- | --- | --- | ### [](#projection)Projection ```fql // Projects the `name`, `description`, and `price` fields. Product.sortedByPriceLowToHigh() { name, description, price } ``` ``` { data: [ { name: "single lime", description: "Conventional, 1 ct", price: 35 }, { name: "cilantro", description: "Organic, 1 bunch", price: 149 }, ... ] } ``` | Reference: Projection and field aliasing | | --- | --- | --- | ### [](#paginate-results)Paginate results Fauna automatically paginates result Sets with 16 or more elements. When a query returns paginated results, Fauna materializes a subset of the Set with an `after` pagination cursor: ```fql // Uses the `Product` collection's `sortedByPriceLowToHigh()` index to // return all `Product` collection documents. // The collection contains more than 16 documents. Product.sortedByPriceLowToHigh() ``` ``` { // The result Set contains 16 elements. data: [ { id: "555", coll: Product, ts: Time("2099-07-30T15:57:03.730Z"), name: "single lime", description: "Conventional, 1 ct", price: 35, stock: 1000, category: Category("789") }, { id: "888", coll: Product, ts: Time("2099-07-30T15:57:03.730Z"), name: "cilantro", description: "Organic, 1 bunch", price: 149, stock: 100, category: Category("789") } ], // Use the `after` cursor to get the next page of results. after: "hdW..." } ``` To get the next page of results, pass the `after` cursor to [`Set.paginate()`](../../../../reference/fql-api/set/static-paginate/): ```fql Set.paginate("hdW...") ``` The Fauna client drivers also include methods for automatically iterating through pages. See: * [JavaScript driver docs](../../../../build/drivers/js-client/#pagination) * [Python driver docs](../../../../build/drivers/py-client/#pagination) * [Go driver docs](../../../../build/drivers/go-client/#pagination) * [.NET/C# driver docs](../../../../build/drivers/dotnet-client/#pagination) * [JVM driver docs](../../../../build/drivers/jvm-client/#pagination) ## [](#document-relationships)Document relationships ### [](#create-a-document-relationship)Create a document relationship To create a document relationship, include a document reference as a field value: ```fql // References a `Category` collection document. let produce = Category.byName("produce").first() // Creates a `Product` collection document. Product.create({ name: "lemons", description: "Organic, 16 ct", price: 2_49, stock: 200, // Adds the previous `Category` document reference as // a `category` field value. category: produce }) ``` | See Create a document relationship | | --- | --- | --- | ### [](#resolve-document-relationships)Resolve document relationships You can project a field that contains a document to dynamically resolve the document reference: ```fql let produce = Category.byName("produce").first() // Projects the `name`, `description`, `price`, // and `category` fields. Product.byCategory(produce) { name, description, price, category } ``` ``` { data: [ { name: "avocados", description: "Conventional Hass, 4ct bag", price: 399, // Resolves the `Category` collection document in // the `category` field. category: { id: "789", coll: Category, ts: Time("2099-07-29T21:18:48.680Z"), products: "hdW...", name: "produce", description: "Fresh Produce" } }, { name: "single lime", description: "Conventional, 1 ct", price: 35, category: { id: "789", coll: Category, ts: Time("2099-07-29T21:18:48.680Z"), products: "hdW...", name: "produce", description: "Fresh Produce" } }, ... ] } ``` | See Resolve document relationships with projection | | --- | --- | --- | ### [](#delete-document-relationships)Delete document relationships To delete a document relationship, remove the field that contains the document reference. Removing the field does not delete the referenced document. For example: ```fql // Updates a `Product` collection document. Product.byId("111")?.update({ // Removes the `category` field, which contains a // reference to a `Category` collection document. // Removing the `category` field does not delete // the `Category` document. category: null }) ``` ### [](#dangling-references)Dangling references Deleting a document does not remove its inbound [document references](../../../data-model/relationships/). Documents may contain [references](../../../data-model/relationships/) to [Nulldocs](../../../../reference/fql/types/#nulldoc) — documents that don’t exist. These are called dangling references. For example: ```fql // Gets a `Product` collection document. // Use projection to return `name`, `description`, and `category` fields. Product.byId("111") { name, description, // The `category` field contains a reference to a `Category` collection document. category } ``` ``` { name: "cups", description: "Translucent 9 Oz, 100 ct", // If the referenced `Category` collection document doesn't exist, // the projection returns a NullDoc. category: Category("123") /* not found */ } ``` ### [](#perform-a-cascading-delete)Perform a cascading delete A cascading delete is an operation where deleting a document in one collection automatically deletes related documents in other collections. Fauna doesn’t provide automatic cascading deletes for user-defined collections. Instead, you can use an index and [`set.forEach()`](../../../../reference/fql-api/set/foreach/) to iterate through a document’s relationships. In the following example, you’ll delete a `Category` collection document and any `Product` documents that reference the category. 1. Define an index as part of a [collection schema](../../../schema/): ```fsl collection Product { ... category: Ref ... // Defines the `byCategory()` index. // Use the index to get `Product` collection // documents by `category` value. In this case, // `category` contains a reference to a `Category` collection document. index byCategory { terms [.category] } } ``` 2. Use the index and [`set.forEach()`](../../../../reference/fql-api/set/foreach/) to delete the category and any related products: ```fql // Gets a `Category` collection document. let category = Category.byId("333") // Gets `Product` collection documents that // contain the `Category` document in the `category` field. let products = Product.byCategory(category) // Deletes the `Category` collection document. category?.delete() // Deletes `Product` collection documents that // contain the `Category` document in the `category` field. products.forEach(.delete()) // Returns `null` ``` ## [](#child-databases)Child databases ### [](#create-a-child-database)Create a child database ```fql // Creates the `childDB` child database. Database.create({ name: "childDB", // Enables typechecking for the database. typechecked: true }) ``` | Reference: Database.create() | | --- | --- | --- | ### [](#get-a-child-database)Get a child database ```fql // Gets the `childDB` child database. Database.byName("childDB") ``` | Reference: Database.byName() | | --- | --- | --- | ### [](#update-a-child-database)Update a child database ```fql // Updates the `childDB` child database's // `typechecked` field. Database.byName("childDB")?.update({typechecked: false}) ``` | Reference: database.update() | | --- | --- | --- | ### [](#delete-a-child-database)Delete a child database ```fql // Deletes the `childDB` child database. Database.byName("childDB")?.delete() ``` | Reference: database.delete() | | --- | --- | --- | # FQL syntax quick look This gives you a quick look at the Fauna Query Language (FQL) syntax. FQL is similar to JavaScript with influences from TypeScript and GraphQL, differing from those languages in that it is optimized for database operations. ## [](#basic-syntax)Basic syntax ```fql // Single-line comments start with double-slash. /* Block comments start with slash-asterisk and end with asterisk-slash. */ // Statements don't have to be terminated by ; ... (1 + 3) * 2 // ... but can be. (1 + 3) * 2; ///////////////////////////////////////////// // Numbers, Strings, and Operators // FQL has integer, decimal, and exponential values stored as // Int, Long, or Double types, which are all Number types. // An Int is a signed 32-bit integer type. // A Long is a signed 64-bit integer type. // Doubles are double-precision, 64-bit binary type, IEEE 754-2019. 3 // 3 1.5 // 1.5 3.14e5 // 314000.0 // Some basic arithmetic works as you'd expect. 1 + 1 // 2 0.1 + 0.2 // 0.30000000000000004 8 - 1 // 7 10 * 2 // 20 35 / 5 // 7 // Including uneven division. 5 / 2 // 2 // Precedence is enforced with parentheses. (1 + 3) * 2 // 8 // There's also a boolean type. true false // Strings are created with ' or ". 'abc' // "abc" "Hello, world" // "Hello, world" // Negation uses the ! symbol !true // false !false // true // Equality is == 1 == 1 // true 2 == 1 // false // Inequality is != 1 != 1 // false 2 != 1 // true // More comparisons 1 < 10 // true 1 > 10 // false 2 <= 2 // true 2 >= 2 // true // Strings are concatenated with + "Hello " + "world!" // "Hello world!" // and are compared with < and > "a" < "b" // true // Type coercion isn't performed for comparisons with double equals... "5" == 5 // false // You can access characters in a string with at() built-in string method. "This is a string".at(0) // "T" // ...or use an index. "Hello world"[0] // "H" // "length" is a property so don't use (). "Hello".length // 5 // There's also "null". null; // used to indicate a deliberate non-value // false, null, 0, and "" are falsy; everything else is truthy. ///////////////////////////////////////////// // Arrays, and Objects // Arrays are ordered lists containing values, of any type. let myArray = ["Hello", 45, true] myArray // ["Hello", 45, true] // Their members can be accessed using the square-brackets subscript syntax. // Array indices start at zero. You can also use the `at()` built-in method. myArray[1] // 45 myArray.at(1) // 45 // Arrays are of variable length. myArray.length // 3 // Accessing an Array index greater than or equal to the Array length: myArray[3] // results in an error. // Create an Array from elements in the range index 1 (include) to // index 4 (exclude). myArray.slice(1, 4) // [45, true] // FQL objects are equivalent to "dictionaries" or "maps" in other // languages: an unordered collection of key:value pairs. You can use // the dot syntax provided the key is a valid identifier. let myObj = {key1: "Hello", key2: "World"} myObj.key1 // "Hello" // Keys are strings but quotes aren't required if they're a valid // JavaScript identifier. Values can be any type. let myObj = {myKey: "myValue", "myOtherKey": 4} // Object attributes can also be accessed using the subscript syntax. myObj.myKey // "myValue" myObj.myOtherKey // 4 // If you try to access a value not yet set, you'll get an error. myObj.myThirdKey // results in an error. ///////////////////////////////////////////// // Variables // Use the "let" keyword to declare variables in a lexical scope and // assign a value to the variable. FQL is dynamically typed, so you don't // need to specify type. Assignment uses a single = character. Also, "let" // can't be the last statement, because it isn't an expression. let someVar = 5 someVar // 5 // A variable in the same scope can be assigned a new value: let someVar = 5 let someVar = 6 someVar // 6 // You can declare only one variable in the same `let` statement. // You can use "let" with an "if ... else" statement to // conditionally assign a variable value. let x = "cat" let y = if (x == "cat") { "Meow" } else if (x == "dog") { "Woof" } else { "Call the exterminator" } y // "Meow" ///////////////////////////////////////////// // Control structures, logic // The `if ... else` structure works as you'd expect. let count = 1 if (count == 3) { // evaluated if count is 3 } else if (count == 4) { // evaluated if count is 4 } else { // evaluated if not 3 or 4 } // `&&` is logical AND, `||` is logical OR let house = {size: "big", color: "blue"} if (house.size == "big" && house.color == "blue") { "big blue house" } if (house.color == "red" || house.color == "blue") { "red or blue" } ///////////////////////////////////////////// // Block scope // A block is defined with `{ }` and variables are scoped to the block. // Variables outside of the block are global. // The last statement in a block must be an expression. let greeting = "hi" { let greeting = "hello" greeting } // "hello" let greeting = "hi" { let greeting = "hello" greeting } greeting // "hi" ///////////////////////////////////////////// // Anonymous functions // FQL anonymous functions are declared using the short-form // arrow syntax. An anonymous function can't be called before the definition. (x) => { let greeting = "hello" greeting } // Objects can contain functions. let myFunc = { (x) => { let double = x + x double } } myFunc(3) // 6 // Some built-in methods accept single-argument functions. Customer.all().where(c => c.address.zipCode == "20002") // Which is equivalent to: let myFunc = { (c) => { c.address.zipCode == "20002" } } Customer.all().where(myFunc) ``` # FQL cheat sheet This page provides a quick reference of FQL properties and methods, grouped by functionality. | Access providerAccessProvider.all()Get a Set of all access providers.AccessProvider.byName()Get an access provider by its name.AccessProvider.create()Create an access provider.AccessProvider.firstWhere()Get the first access provider that matches a provided predicate.AccessProvider.toString()Get "AccessProvider" as a String.AccessProvider.where()Get a Set of access providers that match a provided predicate.accessProvider.delete()Delete an access provider.accessProvider.exists()Test if an access provider exists.accessProvider.replace()Replace an access provider.accessProvider.update()Update an access provider.ArrayArray.sequence()Create an ordered Array of Numbers given start and end values.array.lengthThe number of elements in the Array.array.aggregate()Aggregate all elements of an Array.array.any()Test if any element of an Array matches a provided predicate.array.append()Append a provided element to an Array.array.at()Get the Array element at a provided index.array.concat()Concatenate two Arrays.array.distinct()Get the unique elements of an Array.array.drop()Drop the first N elements of an Array.array.entries()Add the index to each element of an Array.array.every()Test if every element of an Array matches a provided predicate.array.filter()Filter an Array using a provided predicate.array.first()Get the first element of an Array.array.firstWhere()Get the first element of an Array that matches a provided predicate.array.flatMap()Apply a provided function to each Array element and flatten the resulting Array by one level.array.flatten()Flatten an Array by one level.array.fold()Reduce the Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses a provided seed as the initial value.array.foldRight()Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses a provided seed as the initial value.array.forEach()Run a provided function on each element of an Array. Can perform writes.array.includes()Test if the Array includes a provided element.array.indexOf()Get the index of the first Array element that matches a provided value.array.indexWhere()Get the index of the first Array element that matches a provided predicate.array.isEmpty()Test if an Array is empty.array.last()Get the last element of an Array.array.lastIndexOf()Get the index of the last Array element that matches a provided value.array.lastIndexWhere()Get the index of the last Array element that matches a provided predicate.array.lastWhere()Get the last element of an Array that matches a provided predicate.array.map()Apply a provided function to each element of an Array. Can’t perform writes.array.nonEmpty()Test if an Array is not empty.array.order()Sort an Array's elements.array.prepend()Prepend an element to an Array.array.reduce()Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses the first element as the initial value.array.reduceRight()Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses the first element as the initial value.array.reverse()Reverse the order of an Array's elements.array.slice()Get a subset of an Array's elements based on provided indexes.array.take()Get the first N elements of an Array.array.toSet()Convert an Array to a Set.array.toString()Convert an Array to a String.array.where()Get the elements of an Array that match a provided predicate.BytesBytes()Convert a Base64-encoded string to an FQL Bytes value.Bytes.fromBase64()Convert a Base64-encoded string to an FQL Bytes value.bytes.toBase64()Convert an FQL Bytes value to a Base64-encoded string.bytes.toString()Convert an FQL Bytes value to a Base64-encoded string.Collectioncollection.definitionGet a collection definition, represented as a Collection document with the CollectionDef type.Collection()Access a collection by its name.Collection.all()Get a Set of all collection definitions.Collection.byName()Get a collection definitions by its name.Collection.create()Create a collection.Collection.firstWhere()Get the first collection definition that matches a provided predicate.Collection.toString()Get "Collection" as a String.Collection.where()Get a Set of collection definitions that match a provided predicate.collectionDef.delete()Delete a collection.collectionDef.exists()Test if a collection exists.collectionDef.replace()Replaces a collection definition.collectionDef.update()Update a collection definition.collection.all()Get a Set of all documents in a collection.collection.byId()Get a collection document by its document id.collection.create()Create a collection document.collection.firstWhere()Get the first collection document that matches a provided predicate.collection.indexName()Call an index as a method to get a Set of matching collection documents.collection.where()Get a Set of collection documents that match a provided predicate.CredentialCredential.all()Get a Set of all credentials.Credential.byDocument()Get a credential by its identity document.Credential.byId()Get a credential by its document id.Credential.create()Create a credential.Credential.firstWhere()Get the first credential that matches a provided predicate.Credential.toString()Get "Credential" as a String.Credential.where()Get a Set of credentials that match a provided predicate.credential.delete()Delete a credential.credential.exists()Test if a credential exists.credential.login()Create a token for a provided credential and its password.credential.replace()Replace a credential.credential.update()Update a credential.credential.verify()Test whether a provided password is valid for a credential.DatabaseDatabase.all()Get a Set of all child databases nested directly under the database.Database.byName()Get a child database by its name.Database.create()Create a child database.Database.firstWhere()Get the first child database document that matches a provided predicate.Database.toString()Get "Database" as a String.Database.where()Get a Set of child databases that match a provided predicate.database.delete()Deletes a child database.database.exists()Test if a child database exists.database.replace()Replace a child database's metadata and settings.database.update()Update a child database's metadata and settings.DatedayOfMonthGet the day of the month from a Date.dayOfWeekGet the day of the week from a Date.dayOfYearGet the day of the year from a Date.monthGet the month of a Date.yearGet the year of a Date.Date()Construct a Date from a ISO 8601 date String.Date.fromString()Construct a Date from a date String.Date.today()Get the current UTC Date.date.add()Add number of days to a Date.date.difference()Get the difference between two Dates.date.subtract()Subtract number of days from a Date.date.toString()Convert a Date to a String.Documentdocument.delete()Delete a collection document.document.exists()Test if a collection document exists.document.replace()Replace all fields in a collection document.document.update()Update a collection document's fields.EventSourceeventSource.map()Apply an anonymous function to each element of an event source's tracked Set.eventSource.toString()Get "[event source]" as a string.eventSource.where()Create an event source that emits events for a subset of another event source’s tracked Set.Functionfunction.definitionGet or update a user-defined function (UDF)'s definition, represented as a Function document.Function()Call a user-defined function (UDF) by its name.Function.all()Get a Set of all user-defined functions (UDFs).Function.byName()Get a user-defined function (UDF) by its name.Function.create()Create a user-defined function (UDF).Function.firstWhere()Get the first user-defined function (UDF) that matches a provided predicate.Function.toString()Get "Function" as a String.Function.where()Get a Set of user-defined functions (UDFs) that match a provided predicate.functionDef.delete()Delete a user-defined function (UDF).functionDef.exists()Test if a user-defined function (UDF) exists.functionDef.replace()Replace a user-defined function (UDF).functionDef.update()Update a user-defined function (UDF).Global functionsabort()End the current query and return an abort error with a user-defined abort value.dbg()Output a debug message in the query summary and return the message in the query results.ID()Create a valid IDlog()Output a log message in the query summary and return null.newId()Get a unique string-encoded 64-bit integer.KeyKey.all()Get a Set of all keys.Key.byId()Get a key by its document id.Key.create()Create a key.Key.firstWhere()Get the first key that matches a provided predicate.Key.toString()Get "Key" as a String.Key.where()Get a Set of keys that match a provided predicate.key.delete()Delete a key.key.exists()Test if a key exists.key.replace()Replace a key.key.update()Update a key. | AccessProvider.all() | Get a Set of all access providers. | AccessProvider.byName() | Get an access provider by its name. | AccessProvider.create() | Create an access provider. | AccessProvider.firstWhere() | Get the first access provider that matches a provided predicate. | AccessProvider.toString() | Get "AccessProvider" as a String. | AccessProvider.where() | Get a Set of access providers that match a provided predicate. | accessProvider.delete() | Delete an access provider. | accessProvider.exists() | Test if an access provider exists. | accessProvider.replace() | Replace an access provider. | accessProvider.update() | Update an access provider. | Array.sequence() | Create an ordered Array of Numbers given start and end values. | array.length | The number of elements in the Array. | array.aggregate() | Aggregate all elements of an Array. | array.any() | Test if any element of an Array matches a provided predicate. | array.append() | Append a provided element to an Array. | array.at() | Get the Array element at a provided index. | array.concat() | Concatenate two Arrays. | array.distinct() | Get the unique elements of an Array. | array.drop() | Drop the first N elements of an Array. | array.entries() | Add the index to each element of an Array. | array.every() | Test if every element of an Array matches a provided predicate. | array.filter() | Filter an Array using a provided predicate. | array.first() | Get the first element of an Array. | array.firstWhere() | Get the first element of an Array that matches a provided predicate. | array.flatMap() | Apply a provided function to each Array element and flatten the resulting Array by one level. | array.flatten() | Flatten an Array by one level. | array.fold() | Reduce the Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses a provided seed as the initial value. | array.foldRight() | Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses a provided seed as the initial value. | array.forEach() | Run a provided function on each element of an Array. Can perform writes. | array.includes() | Test if the Array includes a provided element. | array.indexOf() | Get the index of the first Array element that matches a provided value. | array.indexWhere() | Get the index of the first Array element that matches a provided predicate. | array.isEmpty() | Test if an Array is empty. | array.last() | Get the last element of an Array. | array.lastIndexOf() | Get the index of the last Array element that matches a provided value. | array.lastIndexWhere() | Get the index of the last Array element that matches a provided predicate. | array.lastWhere() | Get the last element of an Array that matches a provided predicate. | array.map() | Apply a provided function to each element of an Array. Can’t perform writes. | array.nonEmpty() | Test if an Array is not empty. | array.order() | Sort an Array's elements. | array.prepend() | Prepend an element to an Array. | array.reduce() | Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses the first element as the initial value. | array.reduceRight() | Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses the first element as the initial value. | array.reverse() | Reverse the order of an Array's elements. | array.slice() | Get a subset of an Array's elements based on provided indexes. | array.take() | Get the first N elements of an Array. | array.toSet() | Convert an Array to a Set. | array.toString() | Convert an Array to a String. | array.where() | Get the elements of an Array that match a provided predicate. | Bytes() | Convert a Base64-encoded string to an FQL Bytes value. | Bytes.fromBase64() | Convert a Base64-encoded string to an FQL Bytes value. | bytes.toBase64() | Convert an FQL Bytes value to a Base64-encoded string. | bytes.toString() | Convert an FQL Bytes value to a Base64-encoded string. | collection.definition | Get a collection definition, represented as a Collection document with the CollectionDef type. | Collection() | Access a collection by its name. | Collection.all() | Get a Set of all collection definitions. | Collection.byName() | Get a collection definitions by its name. | Collection.create() | Create a collection. | Collection.firstWhere() | Get the first collection definition that matches a provided predicate. | Collection.toString() | Get "Collection" as a String. | Collection.where() | Get a Set of collection definitions that match a provided predicate. | collectionDef.delete() | Delete a collection. | collectionDef.exists() | Test if a collection exists. | collectionDef.replace() | Replaces a collection definition. | collectionDef.update() | Update a collection definition. | collection.all() | Get a Set of all documents in a collection. | collection.byId() | Get a collection document by its document id. | collection.create() | Create a collection document. | collection.firstWhere() | Get the first collection document that matches a provided predicate. | collection.indexName() | Call an index as a method to get a Set of matching collection documents. | collection.where() | Get a Set of collection documents that match a provided predicate. | Credential.all() | Get a Set of all credentials. | Credential.byDocument() | Get a credential by its identity document. | Credential.byId() | Get a credential by its document id. | Credential.create() | Create a credential. | Credential.firstWhere() | Get the first credential that matches a provided predicate. | Credential.toString() | Get "Credential" as a String. | Credential.where() | Get a Set of credentials that match a provided predicate. | credential.delete() | Delete a credential. | credential.exists() | Test if a credential exists. | credential.login() | Create a token for a provided credential and its password. | credential.replace() | Replace a credential. | credential.update() | Update a credential. | credential.verify() | Test whether a provided password is valid for a credential. | Database.all() | Get a Set of all child databases nested directly under the database. | Database.byName() | Get a child database by its name. | Database.create() | Create a child database. | Database.firstWhere() | Get the first child database document that matches a provided predicate. | Database.toString() | Get "Database" as a String. | Database.where() | Get a Set of child databases that match a provided predicate. | database.delete() | Deletes a child database. | database.exists() | Test if a child database exists. | database.replace() | Replace a child database's metadata and settings. | database.update() | Update a child database's metadata and settings. | dayOfMonth | Get the day of the month from a Date. | dayOfWeek | Get the day of the week from a Date. | dayOfYear | Get the day of the year from a Date. | month | Get the month of a Date. | year | Get the year of a Date. | Date() | Construct a Date from a ISO 8601 date String. | Date.fromString() | Construct a Date from a date String. | Date.today() | Get the current UTC Date. | date.add() | Add number of days to a Date. | date.difference() | Get the difference between two Dates. | date.subtract() | Subtract number of days from a Date. | date.toString() | Convert a Date to a String. | document.delete() | Delete a collection document. | document.exists() | Test if a collection document exists. | document.replace() | Replace all fields in a collection document. | document.update() | Update a collection document's fields. | eventSource.map() | Apply an anonymous function to each element of an event source's tracked Set. | eventSource.toString() | Get "[event source]" as a string. | eventSource.where() | Create an event source that emits events for a subset of another event source’s tracked Set. | function.definition | Get or update a user-defined function (UDF)'s definition, represented as a Function document. | Function() | Call a user-defined function (UDF) by its name. | Function.all() | Get a Set of all user-defined functions (UDFs). | Function.byName() | Get a user-defined function (UDF) by its name. | Function.create() | Create a user-defined function (UDF). | Function.firstWhere() | Get the first user-defined function (UDF) that matches a provided predicate. | Function.toString() | Get "Function" as a String. | Function.where() | Get a Set of user-defined functions (UDFs) that match a provided predicate. | functionDef.delete() | Delete a user-defined function (UDF). | functionDef.exists() | Test if a user-defined function (UDF) exists. | functionDef.replace() | Replace a user-defined function (UDF). | functionDef.update() | Update a user-defined function (UDF). | abort() | End the current query and return an abort error with a user-defined abort value. | dbg() | Output a debug message in the query summary and return the message in the query results. | ID() | Create a valid ID | log() | Output a log message in the query summary and return null. | newId() | Get a unique string-encoded 64-bit integer. | Key.all() | Get a Set of all keys. | Key.byId() | Get a key by its document id. | Key.create() | Create a key. | Key.firstWhere() | Get the first key that matches a provided predicate. | Key.toString() | Get "Key" as a String. | Key.where() | Get a Set of keys that match a provided predicate. | key.delete() | Delete a key. | key.exists() | Test if a key exists. | key.replace() | Replace a key. | key.update() | Update a key. | MathMath.EGet the Euler’s number mathematical constant (℮).Math.InfinityString value representing infinity.Math.NaNValue representing Not-a-Number.Math.PIGet the mathematical constant pi (π).Math.abs()Get the absolute value of a Number.Math.acos()Get the inverse cosine in radians of a Number.Math.asin()Get the inverse sine in radians of a Number.Math.atan()Get the inverse tangent in radians of a Number.Math.ceil()Round up a Number.Math.cos()Get the cosine of a Number in radians.Math.cosh()Get the hyperbolic cosine of a Number.Math.degrees()Convert radians to degrees.Math.exp()Get the value of ℮ raised to the power of a Number.Math.floor()Round down a Number.Math.hypot()Get the hypotenuse of a right triangle.Math.log()Get the natural logarithm, base e, of a Number.Math.log10()Get the base 10 logarithm of a Number.Math.max()Get the larger of two Numbers.Math.mean()Get the arithmetic mean of an Array or Set of Numbers.Math.min()Get the smaller of the input parameter Numbers.Math.pow()Get the value of a base raised to a power.Math.radians()Convert the value of a Number in degrees to radians.Math.round()Get the value of a Number rounded to the nearest integer.Math.sign()Get the sign of a Number.Math.sin()Get the sine of a Number in radians.Math.sinh()Get the hyperbolic sine of a Number.Math.sqrt()Get the square root of a Number.Math.sum()Get the sum of an Array or Set of Numbers.Math.tan()Get the tangent of a Number in radians.Math.tanh()Get the hyperbolic tangent of a Number.Math.trunc()Truncate a Number to a given precision.ObjectObject.assign()Copies properties from a source Object to a destination Object.Object.entries()Convert an Object to an Array of key-value pairs.Object.fromEntries()Convert an Array of key-value pairs to an Object.Object.hasPath()Test if an Object has a property.Object.keys()Get an Object's top-level property keys as an Array.Object.select()Get an Object property’s value by its path.Object.toString()Convert an Object to a String.Object.values()Get an Object's property values as an Array.QueryQuery.identity()Get the identity document for the query’s authentication token.Query.isEnvProtected()Test if the queried database is in protected mode.Query.isEnvTypechecked()Test if the queried database is typechecked.Query.token()Get the Token document or JWT payload for the query’s authentication secret.RoleRole.all()Get a Set of all user-defined roles.Role.byName()Get a user-defined role by its name.Role.create()Create a user-defined role.Role.firstWhere()Get the first user-defined role matching a provided predicate.Role.toString()Get "Role" as a String.Role.where()Get a Set of user-defined roles that match a provided predicate.role.delete()Delete a user-defined role.role.exists()Test if a user-defined role exists.role.replace()Replace a user-defined role.role.update()Update a user-defined role.SchemaFQL.Schema.defForIdentifier()Returns the definition for a user-defined collection or user-defined function (UDF) using the same rules as top-level identifier lookups.SetSet.paginate()Get a page of paginated results using an after cursor.Set.sequence()Create an ordered Set of Numbers given start and end values.Set.single()Create a Set containing a single provided element.set.aggregate()Aggregate all elements of a Set.set.any()Test if any element of a Set matches a provided predicate.set.changesOn()Create an event source that tracks changes to specified document fields in a supported Set.set.concat()Concatenate two Sets.set.count()Get the number of elements in a Set.set.distinct()Get the unique elements of a Set.set.drop()Drop the first N elements of a Set.set.eventsOn()Create an event source that tracks changes to specified document fields in a supported Set.set.eventSource()Create an event source that tracks changes to documents in a supported Set.set.every()Test if every element of a Set matches a provided predicate.set.first()Get the first element of a Set.set.firstWhere()Get the first element of a Set that matches a provided predicate.set.flatMap()Apply a provided function to each Set element and flatten the resulting Set by one level.set.fold()Reduce the Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses a provided seed as the initial value.set.foldRight()Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses a provided seed as the initial value.set.forEach()Run a provided function on each element of a Set. Can perform writes.set.includes()Test if the Set includes a provided element.set.isEmpty()Test if a Set is empty.set.last()Get the last element of a Set.set.lastWhere()Get the last element of a Set that matches a provided predicate.set.map()Apply a provided function to each element of a Set. Can’t perform writes.set.nonEmpty()Test if a Set is not empty.set.order()Sort a Set's elements.set.pageSize()Set the maximum elements per page in paginated results.set.paginate()Convert a Set to an Object with pagination.set.reduce()Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses the first element as the initial value.set.reduceRight()Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses the first element as the initial value.set.reverse()Reverse the order of a Set's elements.set.take()Get the first N elements of a Set.set.toArray()Convert a Set to an Array.set.toStream()Create an event source that tracks changes to documents in a supported Set.set.toString()Return the string "[set]".set.where()Get the elements of a Set that match a provided predicate.Stringstring.lengthGet a String's length.string.at()Get the character at a specified index of a String.string.casefold()Convert a String to lower case using a specified format.string.concat()Concatenate two Strings.string.endsWith()Test if a String ends with a provided suffix.string.includes()Test if a String includes a provided substring.string.includesRegex()Test if a String contains a substring that matches a provided regular expression.string.indexOf()Get the index of the first matching substring within a String.string.indexOfRegex()Get the index of the first substring matching a provided regular expression within a String.string.insert()Insert a substring into a String at a specified index.string.lastIndexOf()Get the index of the last matching substring within a String.string.matches()Get the substrings in a String that match a provided regular expression.string.matchIndexes()Get the indexes and substrings in a String that match a provided regular expression.string.parseDouble()Convert a String to a Double.string.parseInt()Convert a String to a Int.string.parseLong()Convert a String to a Long.string.parseNumber()Convert a String to a Number.string.replace()Replace a specified number of occurrences of a substring in a String.string.replaceAll()Replace all occurrences of a substring in a String.string.replaceAllRegex()Replace all occurrences of substrings matching a regular expression in a String.string.replaceRegex()Replace a specified number of occurrences of substrings matching a regular expression in a String.string.slice()Get the substring between two indexes of a String.string.split()Split a String at a provided separator.string.splitAt()Split a String at a provided index.string.splitRegex()Split a String using a provided regular expression.string.startsWith()Test if a String starts with a provided prefix.string.toLowerCase()Convert a String to lower case.string.toString()Get a String representation of the value.string.toUpperCase()Convert a String to upper case.TimedayOfMonthGet the day of the month from a Time.dayOfWeekGet the day of the week from a Time.dayOfYearGet the day of the year from a Time.hourGet the hour of a Time.minuteGet the minute of a Time.monthGet the month of a Time.secondGet the second of a Time.yearGet the year of a Time.Time()Construct a Time from an ISO 8601 timestamp String.Time.epoch()Convert a Unix epoch timestamp to a Time.Time.fromString()Construct a Time from an ISO 8601 timestamp String.Time.now()Get the current UTC Time.time.add()Add a time interval to a Time.time.difference()Get the difference between two Times.time.subtract()Subtract a time interval from a Time.time.toMicros()Convert a Time to a Unix epoch timestamp in microseconds.time.toMillis()Convert a Time to a Unix epoch timestamp in milliseconds.time.toSeconds()Convert a Time to a Unix epoch timestamp in seconds.time.toString()Convert a Time to a String.TokenToken.all()Get a Set of all tokens.Token.byDocument()Get a token by its identity document.Token.byId()Get a token by its document id.Token.create()Create a token without a credential or related password.Token.firstWhere()Get the first token that matches a provided predicate.Token.toString()Get "Token" as a String.Token.where()Get a Set of tokens that match a provided predicate.token.delete()Delete a token.token.exists()Test if a token exists.token.replace()Replace a token.token.update()Update a token.Transaction TimeTransactionTime()Get the query transaction time.TransactionTime.toString()Get "[transaction time]" as a String. | Math.E | Get the Euler’s number mathematical constant (℮). | Math.Infinity | String value representing infinity. | Math.NaN | Value representing Not-a-Number. | Math.PI | Get the mathematical constant pi (π). | Math.abs() | Get the absolute value of a Number. | Math.acos() | Get the inverse cosine in radians of a Number. | Math.asin() | Get the inverse sine in radians of a Number. | Math.atan() | Get the inverse tangent in radians of a Number. | Math.ceil() | Round up a Number. | Math.cos() | Get the cosine of a Number in radians. | Math.cosh() | Get the hyperbolic cosine of a Number. | Math.degrees() | Convert radians to degrees. | Math.exp() | Get the value of ℮ raised to the power of a Number. | Math.floor() | Round down a Number. | Math.hypot() | Get the hypotenuse of a right triangle. | Math.log() | Get the natural logarithm, base e, of a Number. | Math.log10() | Get the base 10 logarithm of a Number. | Math.max() | Get the larger of two Numbers. | Math.mean() | Get the arithmetic mean of an Array or Set of Numbers. | Math.min() | Get the smaller of the input parameter Numbers. | Math.pow() | Get the value of a base raised to a power. | Math.radians() | Convert the value of a Number in degrees to radians. | Math.round() | Get the value of a Number rounded to the nearest integer. | Math.sign() | Get the sign of a Number. | Math.sin() | Get the sine of a Number in radians. | Math.sinh() | Get the hyperbolic sine of a Number. | Math.sqrt() | Get the square root of a Number. | Math.sum() | Get the sum of an Array or Set of Numbers. | Math.tan() | Get the tangent of a Number in radians. | Math.tanh() | Get the hyperbolic tangent of a Number. | Math.trunc() | Truncate a Number to a given precision. | Object.assign() | Copies properties from a source Object to a destination Object. | Object.entries() | Convert an Object to an Array of key-value pairs. | Object.fromEntries() | Convert an Array of key-value pairs to an Object. | Object.hasPath() | Test if an Object has a property. | Object.keys() | Get an Object's top-level property keys as an Array. | Object.select() | Get an Object property’s value by its path. | Object.toString() | Convert an Object to a String. | Object.values() | Get an Object's property values as an Array. | Query.identity() | Get the identity document for the query’s authentication token. | Query.isEnvProtected() | Test if the queried database is in protected mode. | Query.isEnvTypechecked() | Test if the queried database is typechecked. | Query.token() | Get the Token document or JWT payload for the query’s authentication secret. | Role.all() | Get a Set of all user-defined roles. | Role.byName() | Get a user-defined role by its name. | Role.create() | Create a user-defined role. | Role.firstWhere() | Get the first user-defined role matching a provided predicate. | Role.toString() | Get "Role" as a String. | Role.where() | Get a Set of user-defined roles that match a provided predicate. | role.delete() | Delete a user-defined role. | role.exists() | Test if a user-defined role exists. | role.replace() | Replace a user-defined role. | role.update() | Update a user-defined role. | FQL.Schema.defForIdentifier() | Returns the definition for a user-defined collection or user-defined function (UDF) using the same rules as top-level identifier lookups. | Set.paginate() | Get a page of paginated results using an after cursor. | Set.sequence() | Create an ordered Set of Numbers given start and end values. | Set.single() | Create a Set containing a single provided element. | set.aggregate() | Aggregate all elements of a Set. | set.any() | Test if any element of a Set matches a provided predicate. | set.changesOn() | Create an event source that tracks changes to specified document fields in a supported Set. | set.concat() | Concatenate two Sets. | set.count() | Get the number of elements in a Set. | set.distinct() | Get the unique elements of a Set. | set.drop() | Drop the first N elements of a Set. | set.eventsOn() | Create an event source that tracks changes to specified document fields in a supported Set. | set.eventSource() | Create an event source that tracks changes to documents in a supported Set. | set.every() | Test if every element of a Set matches a provided predicate. | set.first() | Get the first element of a Set. | set.firstWhere() | Get the first element of a Set that matches a provided predicate. | set.flatMap() | Apply a provided function to each Set element and flatten the resulting Set by one level. | set.fold() | Reduce the Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses a provided seed as the initial value. | set.foldRight() | Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses a provided seed as the initial value. | set.forEach() | Run a provided function on each element of a Set. Can perform writes. | set.includes() | Test if the Set includes a provided element. | set.isEmpty() | Test if a Set is empty. | set.last() | Get the last element of a Set. | set.lastWhere() | Get the last element of a Set that matches a provided predicate. | set.map() | Apply a provided function to each element of a Set. Can’t perform writes. | set.nonEmpty() | Test if a Set is not empty. | set.order() | Sort a Set's elements. | set.pageSize() | Set the maximum elements per page in paginated results. | set.paginate() | Convert a Set to an Object with pagination. | set.reduce() | Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses the first element as the initial value. | set.reduceRight() | Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses the first element as the initial value. | set.reverse() | Reverse the order of a Set's elements. | set.take() | Get the first N elements of a Set. | set.toArray() | Convert a Set to an Array. | set.toStream() | Create an event source that tracks changes to documents in a supported Set. | set.toString() | Return the string "[set]". | set.where() | Get the elements of a Set that match a provided predicate. | string.length | Get a String's length. | string.at() | Get the character at a specified index of a String. | string.casefold() | Convert a String to lower case using a specified format. | string.concat() | Concatenate two Strings. | string.endsWith() | Test if a String ends with a provided suffix. | string.includes() | Test if a String includes a provided substring. | string.includesRegex() | Test if a String contains a substring that matches a provided regular expression. | string.indexOf() | Get the index of the first matching substring within a String. | string.indexOfRegex() | Get the index of the first substring matching a provided regular expression within a String. | string.insert() | Insert a substring into a String at a specified index. | string.lastIndexOf() | Get the index of the last matching substring within a String. | string.matches() | Get the substrings in a String that match a provided regular expression. | string.matchIndexes() | Get the indexes and substrings in a String that match a provided regular expression. | string.parseDouble() | Convert a String to a Double. | string.parseInt() | Convert a String to a Int. | string.parseLong() | Convert a String to a Long. | string.parseNumber() | Convert a String to a Number. | string.replace() | Replace a specified number of occurrences of a substring in a String. | string.replaceAll() | Replace all occurrences of a substring in a String. | string.replaceAllRegex() | Replace all occurrences of substrings matching a regular expression in a String. | string.replaceRegex() | Replace a specified number of occurrences of substrings matching a regular expression in a String. | string.slice() | Get the substring between two indexes of a String. | string.split() | Split a String at a provided separator. | string.splitAt() | Split a String at a provided index. | string.splitRegex() | Split a String using a provided regular expression. | string.startsWith() | Test if a String starts with a provided prefix. | string.toLowerCase() | Convert a String to lower case. | string.toString() | Get a String representation of the value. | string.toUpperCase() | Convert a String to upper case. | dayOfMonth | Get the day of the month from a Time. | dayOfWeek | Get the day of the week from a Time. | dayOfYear | Get the day of the year from a Time. | hour | Get the hour of a Time. | minute | Get the minute of a Time. | month | Get the month of a Time. | second | Get the second of a Time. | year | Get the year of a Time. | Time() | Construct a Time from an ISO 8601 timestamp String. | Time.epoch() | Convert a Unix epoch timestamp to a Time. | Time.fromString() | Construct a Time from an ISO 8601 timestamp String. | Time.now() | Get the current UTC Time. | time.add() | Add a time interval to a Time. | time.difference() | Get the difference between two Times. | time.subtract() | Subtract a time interval from a Time. | time.toMicros() | Convert a Time to a Unix epoch timestamp in microseconds. | time.toMillis() | Convert a Time to a Unix epoch timestamp in milliseconds. | time.toSeconds() | Convert a Time to a Unix epoch timestamp in seconds. | time.toString() | Convert a Time to a String. | Token.all() | Get a Set of all tokens. | Token.byDocument() | Get a token by its identity document. | Token.byId() | Get a token by its document id. | Token.create() | Create a token without a credential or related password. | Token.firstWhere() | Get the first token that matches a provided predicate. | Token.toString() | Get "Token" as a String. | Token.where() | Get a Set of tokens that match a provided predicate. | token.delete() | Delete a token. | token.exists() | Test if a token exists. | token.replace() | Replace a token. | token.update() | Update a token. | TransactionTime() | Get the query transaction time. | TransactionTime.toString() | Get "[transaction time]" as a String. | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | AccessProvider.all() | Get a Set of all access providers. | | AccessProvider.byName() | Get an access provider by its name. | | AccessProvider.create() | Create an access provider. | | AccessProvider.firstWhere() | Get the first access provider that matches a provided predicate. | | AccessProvider.toString() | Get "AccessProvider" as a String. | | AccessProvider.where() | Get a Set of access providers that match a provided predicate. | | accessProvider.delete() | Delete an access provider. | | accessProvider.exists() | Test if an access provider exists. | | accessProvider.replace() | Replace an access provider. | | accessProvider.update() | Update an access provider. | | Array.sequence() | Create an ordered Array of Numbers given start and end values. | | array.length | The number of elements in the Array. | | array.aggregate() | Aggregate all elements of an Array. | | array.any() | Test if any element of an Array matches a provided predicate. | | array.append() | Append a provided element to an Array. | | array.at() | Get the Array element at a provided index. | | array.concat() | Concatenate two Arrays. | | array.distinct() | Get the unique elements of an Array. | | array.drop() | Drop the first N elements of an Array. | | array.entries() | Add the index to each element of an Array. | | array.every() | Test if every element of an Array matches a provided predicate. | | array.filter() | Filter an Array using a provided predicate. | | array.first() | Get the first element of an Array. | | array.firstWhere() | Get the first element of an Array that matches a provided predicate. | | array.flatMap() | Apply a provided function to each Array element and flatten the resulting Array by one level. | | array.flatten() | Flatten an Array by one level. | | array.fold() | Reduce the Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses a provided seed as the initial value. | | array.foldRight() | Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses a provided seed as the initial value. | | array.forEach() | Run a provided function on each element of an Array. Can perform writes. | | array.includes() | Test if the Array includes a provided element. | | array.indexOf() | Get the index of the first Array element that matches a provided value. | | array.indexWhere() | Get the index of the first Array element that matches a provided predicate. | | array.isEmpty() | Test if an Array is empty. | | array.last() | Get the last element of an Array. | | array.lastIndexOf() | Get the index of the last Array element that matches a provided value. | | array.lastIndexWhere() | Get the index of the last Array element that matches a provided predicate. | | array.lastWhere() | Get the last element of an Array that matches a provided predicate. | | array.map() | Apply a provided function to each element of an Array. Can’t perform writes. | | array.nonEmpty() | Test if an Array is not empty. | | array.order() | Sort an Array's elements. | | array.prepend() | Prepend an element to an Array. | | array.reduce() | Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses the first element as the initial value. | | array.reduceRight() | Reduce an Array to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses the first element as the initial value. | | array.reverse() | Reverse the order of an Array's elements. | | array.slice() | Get a subset of an Array's elements based on provided indexes. | | array.take() | Get the first N elements of an Array. | | array.toSet() | Convert an Array to a Set. | | array.toString() | Convert an Array to a String. | | array.where() | Get the elements of an Array that match a provided predicate. | | Bytes() | Convert a Base64-encoded string to an FQL Bytes value. | | Bytes.fromBase64() | Convert a Base64-encoded string to an FQL Bytes value. | | bytes.toBase64() | Convert an FQL Bytes value to a Base64-encoded string. | | bytes.toString() | Convert an FQL Bytes value to a Base64-encoded string. | | collection.definition | Get a collection definition, represented as a Collection document with the CollectionDef type. | | Collection() | Access a collection by its name. | | Collection.all() | Get a Set of all collection definitions. | | Collection.byName() | Get a collection definitions by its name. | | Collection.create() | Create a collection. | | Collection.firstWhere() | Get the first collection definition that matches a provided predicate. | | Collection.toString() | Get "Collection" as a String. | | Collection.where() | Get a Set of collection definitions that match a provided predicate. | | collectionDef.delete() | Delete a collection. | | collectionDef.exists() | Test if a collection exists. | | collectionDef.replace() | Replaces a collection definition. | | collectionDef.update() | Update a collection definition. | | collection.all() | Get a Set of all documents in a collection. | | collection.byId() | Get a collection document by its document id. | | collection.create() | Create a collection document. | | collection.firstWhere() | Get the first collection document that matches a provided predicate. | | collection.indexName() | Call an index as a method to get a Set of matching collection documents. | | collection.where() | Get a Set of collection documents that match a provided predicate. | | Credential.all() | Get a Set of all credentials. | | Credential.byDocument() | Get a credential by its identity document. | | Credential.byId() | Get a credential by its document id. | | Credential.create() | Create a credential. | | Credential.firstWhere() | Get the first credential that matches a provided predicate. | | Credential.toString() | Get "Credential" as a String. | | Credential.where() | Get a Set of credentials that match a provided predicate. | | credential.delete() | Delete a credential. | | credential.exists() | Test if a credential exists. | | credential.login() | Create a token for a provided credential and its password. | | credential.replace() | Replace a credential. | | credential.update() | Update a credential. | | credential.verify() | Test whether a provided password is valid for a credential. | | Database.all() | Get a Set of all child databases nested directly under the database. | | Database.byName() | Get a child database by its name. | | Database.create() | Create a child database. | | Database.firstWhere() | Get the first child database document that matches a provided predicate. | | Database.toString() | Get "Database" as a String. | | Database.where() | Get a Set of child databases that match a provided predicate. | | database.delete() | Deletes a child database. | | database.exists() | Test if a child database exists. | | database.replace() | Replace a child database's metadata and settings. | | database.update() | Update a child database's metadata and settings. | | dayOfMonth | Get the day of the month from a Date. | | dayOfWeek | Get the day of the week from a Date. | | dayOfYear | Get the day of the year from a Date. | | month | Get the month of a Date. | | year | Get the year of a Date. | | Date() | Construct a Date from a ISO 8601 date String. | | Date.fromString() | Construct a Date from a date String. | | Date.today() | Get the current UTC Date. | | date.add() | Add number of days to a Date. | | date.difference() | Get the difference between two Dates. | | date.subtract() | Subtract number of days from a Date. | | date.toString() | Convert a Date to a String. | | document.delete() | Delete a collection document. | | document.exists() | Test if a collection document exists. | | document.replace() | Replace all fields in a collection document. | | document.update() | Update a collection document's fields. | | eventSource.map() | Apply an anonymous function to each element of an event source's tracked Set. | | eventSource.toString() | Get "[event source]" as a string. | | eventSource.where() | Create an event source that emits events for a subset of another event source’s tracked Set. | | function.definition | Get or update a user-defined function (UDF)'s definition, represented as a Function document. | | Function() | Call a user-defined function (UDF) by its name. | | Function.all() | Get a Set of all user-defined functions (UDFs). | | Function.byName() | Get a user-defined function (UDF) by its name. | | Function.create() | Create a user-defined function (UDF). | | Function.firstWhere() | Get the first user-defined function (UDF) that matches a provided predicate. | | Function.toString() | Get "Function" as a String. | | Function.where() | Get a Set of user-defined functions (UDFs) that match a provided predicate. | | functionDef.delete() | Delete a user-defined function (UDF). | | functionDef.exists() | Test if a user-defined function (UDF) exists. | | functionDef.replace() | Replace a user-defined function (UDF). | | functionDef.update() | Update a user-defined function (UDF). | | abort() | End the current query and return an abort error with a user-defined abort value. | | dbg() | Output a debug message in the query summary and return the message in the query results. | | ID() | Create a valid ID | | log() | Output a log message in the query summary and return null. | | newId() | Get a unique string-encoded 64-bit integer. | | Key.all() | Get a Set of all keys. | | Key.byId() | Get a key by its document id. | | Key.create() | Create a key. | | Key.firstWhere() | Get the first key that matches a provided predicate. | | Key.toString() | Get "Key" as a String. | | Key.where() | Get a Set of keys that match a provided predicate. | | key.delete() | Delete a key. | | key.exists() | Test if a key exists. | | key.replace() | Replace a key. | | key.update() | Update a key. | | Math.E | Get the Euler’s number mathematical constant (℮). | | Math.Infinity | String value representing infinity. | | Math.NaN | Value representing Not-a-Number. | | Math.PI | Get the mathematical constant pi (π). | | Math.abs() | Get the absolute value of a Number. | | Math.acos() | Get the inverse cosine in radians of a Number. | | Math.asin() | Get the inverse sine in radians of a Number. | | Math.atan() | Get the inverse tangent in radians of a Number. | | Math.ceil() | Round up a Number. | | Math.cos() | Get the cosine of a Number in radians. | | Math.cosh() | Get the hyperbolic cosine of a Number. | | Math.degrees() | Convert radians to degrees. | | Math.exp() | Get the value of ℮ raised to the power of a Number. | | Math.floor() | Round down a Number. | | Math.hypot() | Get the hypotenuse of a right triangle. | | Math.log() | Get the natural logarithm, base e, of a Number. | | Math.log10() | Get the base 10 logarithm of a Number. | | Math.max() | Get the larger of two Numbers. | | Math.mean() | Get the arithmetic mean of an Array or Set of Numbers. | | Math.min() | Get the smaller of the input parameter Numbers. | | Math.pow() | Get the value of a base raised to a power. | | Math.radians() | Convert the value of a Number in degrees to radians. | | Math.round() | Get the value of a Number rounded to the nearest integer. | | Math.sign() | Get the sign of a Number. | | Math.sin() | Get the sine of a Number in radians. | | Math.sinh() | Get the hyperbolic sine of a Number. | | Math.sqrt() | Get the square root of a Number. | | Math.sum() | Get the sum of an Array or Set of Numbers. | | Math.tan() | Get the tangent of a Number in radians. | | Math.tanh() | Get the hyperbolic tangent of a Number. | | Math.trunc() | Truncate a Number to a given precision. | | Object.assign() | Copies properties from a source Object to a destination Object. | | Object.entries() | Convert an Object to an Array of key-value pairs. | | Object.fromEntries() | Convert an Array of key-value pairs to an Object. | | Object.hasPath() | Test if an Object has a property. | | Object.keys() | Get an Object's top-level property keys as an Array. | | Object.select() | Get an Object property’s value by its path. | | Object.toString() | Convert an Object to a String. | | Object.values() | Get an Object's property values as an Array. | | Query.identity() | Get the identity document for the query’s authentication token. | | Query.isEnvProtected() | Test if the queried database is in protected mode. | | Query.isEnvTypechecked() | Test if the queried database is typechecked. | | Query.token() | Get the Token document or JWT payload for the query’s authentication secret. | | Role.all() | Get a Set of all user-defined roles. | | Role.byName() | Get a user-defined role by its name. | | Role.create() | Create a user-defined role. | | Role.firstWhere() | Get the first user-defined role matching a provided predicate. | | Role.toString() | Get "Role" as a String. | | Role.where() | Get a Set of user-defined roles that match a provided predicate. | | role.delete() | Delete a user-defined role. | | role.exists() | Test if a user-defined role exists. | | role.replace() | Replace a user-defined role. | | role.update() | Update a user-defined role. | | FQL.Schema.defForIdentifier() | Returns the definition for a user-defined collection or user-defined function (UDF) using the same rules as top-level identifier lookups. | | Set.paginate() | Get a page of paginated results using an after cursor. | | Set.sequence() | Create an ordered Set of Numbers given start and end values. | | Set.single() | Create a Set containing a single provided element. | | set.aggregate() | Aggregate all elements of a Set. | | set.any() | Test if any element of a Set matches a provided predicate. | | set.changesOn() | Create an event source that tracks changes to specified document fields in a supported Set. | | set.concat() | Concatenate two Sets. | | set.count() | Get the number of elements in a Set. | | set.distinct() | Get the unique elements of a Set. | | set.drop() | Drop the first N elements of a Set. | | set.eventsOn() | Create an event source that tracks changes to specified document fields in a supported Set. | | set.eventSource() | Create an event source that tracks changes to documents in a supported Set. | | set.every() | Test if every element of a Set matches a provided predicate. | | set.first() | Get the first element of a Set. | | set.firstWhere() | Get the first element of a Set that matches a provided predicate. | | set.flatMap() | Apply a provided function to each Set element and flatten the resulting Set by one level. | | set.fold() | Reduce the Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses a provided seed as the initial value. | | set.foldRight() | Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses a provided seed as the initial value. | | set.forEach() | Run a provided function on each element of a Set. Can perform writes. | | set.includes() | Test if the Set includes a provided element. | | set.isEmpty() | Test if a Set is empty. | | set.last() | Get the last element of a Set. | | set.lastWhere() | Get the last element of a Set that matches a provided predicate. | | set.map() | Apply a provided function to each element of a Set. Can’t perform writes. | | set.nonEmpty() | Test if a Set is not empty. | | set.order() | Sort a Set's elements. | | set.pageSize() | Set the maximum elements per page in paginated results. | | set.paginate() | Convert a Set to an Object with pagination. | | set.reduce() | Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from left to right. Uses the first element as the initial value. | | set.reduceRight() | Reduce a Set to a single, accumulated value by applying a provided function to each element. Iterates through elements from right to left. Uses the first element as the initial value. | | set.reverse() | Reverse the order of a Set's elements. | | set.take() | Get the first N elements of a Set. | | set.toArray() | Convert a Set to an Array. | | set.toStream() | Create an event source that tracks changes to documents in a supported Set. | | set.toString() | Return the string "[set]". | | set.where() | Get the elements of a Set that match a provided predicate. | | string.length | Get a String's length. | | string.at() | Get the character at a specified index of a String. | | string.casefold() | Convert a String to lower case using a specified format. | | string.concat() | Concatenate two Strings. | | string.endsWith() | Test if a String ends with a provided suffix. | | string.includes() | Test if a String includes a provided substring. | | string.includesRegex() | Test if a String contains a substring that matches a provided regular expression. | | string.indexOf() | Get the index of the first matching substring within a String. | | string.indexOfRegex() | Get the index of the first substring matching a provided regular expression within a String. | | string.insert() | Insert a substring into a String at a specified index. | | string.lastIndexOf() | Get the index of the last matching substring within a String. | | string.matches() | Get the substrings in a String that match a provided regular expression. | | string.matchIndexes() | Get the indexes and substrings in a String that match a provided regular expression. | | string.parseDouble() | Convert a String to a Double. | | string.parseInt() | Convert a String to a Int. | | string.parseLong() | Convert a String to a Long. | | string.parseNumber() | Convert a String to a Number. | | string.replace() | Replace a specified number of occurrences of a substring in a String. | | string.replaceAll() | Replace all occurrences of a substring in a String. | | string.replaceAllRegex() | Replace all occurrences of substrings matching a regular expression in a String. | | string.replaceRegex() | Replace a specified number of occurrences of substrings matching a regular expression in a String. | | string.slice() | Get the substring between two indexes of a String. | | string.split() | Split a String at a provided separator. | | string.splitAt() | Split a String at a provided index. | | string.splitRegex() | Split a String using a provided regular expression. | | string.startsWith() | Test if a String starts with a provided prefix. | | string.toLowerCase() | Convert a String to lower case. | | string.toString() | Get a String representation of the value. | | string.toUpperCase() | Convert a String to upper case. | | dayOfMonth | Get the day of the month from a Time. | | dayOfWeek | Get the day of the week from a Time. | | dayOfYear | Get the day of the year from a Time. | | hour | Get the hour of a Time. | | minute | Get the minute of a Time. | | month | Get the month of a Time. | | second | Get the second of a Time. | | year | Get the year of a Time. | | Time() | Construct a Time from an ISO 8601 timestamp String. | | Time.epoch() | Convert a Unix epoch timestamp to a Time. | | Time.fromString() | Construct a Time from an ISO 8601 timestamp String. | | Time.now() | Get the current UTC Time. | | time.add() | Add a time interval to a Time. | | time.difference() | Get the difference between two Times. | | time.subtract() | Subtract a time interval from a Time. | | time.toMicros() | Convert a Time to a Unix epoch timestamp in microseconds. | | time.toMillis() | Convert a Time to a Unix epoch timestamp in milliseconds. | | time.toSeconds() | Convert a Time to a Unix epoch timestamp in seconds. | | time.toString() | Convert a Time to a String. | | Token.all() | Get a Set of all tokens. | | Token.byDocument() | Get a token by its identity document. | | Token.byId() | Get a token by its document id. | | Token.create() | Create a token without a credential or related password. | | Token.firstWhere() | Get the first token that matches a provided predicate. | | Token.toString() | Get "Token" as a String. | | Token.where() | Get a Set of tokens that match a provided predicate. | | token.delete() | Delete a token. | | token.exists() | Test if a token exists. | | token.replace() | Replace a token. | | token.update() | Update a token. | | TransactionTime() | Get the query transaction time. | | TransactionTime.toString() | Get "[transaction time]" as a String. |