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.

Some set methods have lazy loading, as opposed to eager loading, in that they compute the result when the data is needed instead of instantly. Eager methods return a result set instantly. Lazy methods return a result set when the query forces the set to be materialized. See the individual method description for whether it is lazy loading or not. For distinct() and order() the full set is read to get the distinct and ordered version when a page on the set is materialized.

Static methods

Method Description

Gets a page of paginated results using an after cursor.

Get an ordered set of values given beginning and ending values.

Creates a Set containing a single provided element.

Instance methods

Method Description

Aggregate all the elements in the set.

Test if any element passes the test of the given function.

Creates a stream that tracks changes to specified document fields in a Set.

Create an Set by concatenating two Sets.

Get the number of values in a Set.

Get unique elements.

Drop elements given a count.

Test if every set element passes the given function test.

Get the first value in the Set.

Get the first matching value from the Set.

Create an Set by applying a Function to each Set element, then flatten the result by one level.

Reduce a set to a single, accumulated value by applying a function to each element. Iterates through elements from left to right. Uses a provided seed as the initial value.

Reduce a set to a single, accumulated value by applying a function to each element. Iterates through elements from right to left. Uses a provided seed as the initial value.

Iterate over all values in a Set, executing a function on each value.

Test if the set includes the given value.

Test if the set is empty.

Get the last element in a set.

Get the last element that matches the given predicate.

Create a Set by applying a function to each Set value.

Test if the set is empty.

Get a new Set by sorting this Set.

Sets the maximum elements per page in paginated results.

Returns the calling Set as an Object with pagination.

Reduce a set to a single, accumulated value by applying a function to each element. Iterates through elements from left to right. Uses the first element as the initial value.

Reduce a set to a single, accumulated value by applying a function to each element. Iterates through elements from right to left. Uses the first element as the initial value.

Reverse the order of the set elements.

Get a subset of matching Set values.

Convert a Set to an Array.

Creates a stream that tracks changes to documents in a Set.

Returns the string "[set]".

Get the next or previous page of Set values that correspond to a previously acquired pagination token.

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!