Check out v4 of the Fauna CLI
v4 of the Fauna CLI is now in beta. The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start. |
Set
Set methods and properties.
Description
A Set represents a group of values, for example, documents in a Collection. When a Set is returned from a query, it is materialized into a page of results that includes a subset of the Set with a pagination cursor.
Lazy vs. Eager loading
To minimize resource consumption, Set methods use lazy loading where possible. These methods defer the materialization of the calling Set and related computations until the data is explicitly needed.
Other Set methods, such as set.includes()
, require eager loading.
These methods materialize the entire calling Set upfront, even if not all data
is returned in the results. For unindexed document Sets, this requires a read of
each document in the Set.
Static methods
Method | Description |
---|---|
Get a page of paginated results using an
|
|
Create a Set containing a single provided element. |
Instance methods
Method | Description |
---|---|
Aggregate all elements of a Set. |
|
Test if any element of a Set matches a provided predicate. |
|
A deprecated alias for |
|
Concatenate two Sets. |
|
Get the number of elements in a Set. |
|
Get the unique elements of a Set. |
|
Drop the first N elements of a Set. |
|
Create an event source that tracks changes to specified document fields in a supported Set. |
|
Create an event source that tracks changes to documents in a supported Set. |
|
Test if every element of a Set matches a provided predicate. |
|
Get the first element of a Set. |
|
Test if the Set includes a provided element. |
|
Test if a Set is empty. |
|
Get the last element of a Set. |
|
Test if a Set is not empty. |
|
Sort a Set's elements. |
|
Set the maximum elements per page in paginated results. |
|
Convert a Set to an Object with pagination. |
|
Reverse the order of a Set's elements. |
|
Get the first N elements of a Set. |
|
A deprecated alias for |
|
Returns the string |
|
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!