Sets represent a grouping of objects with their backing source mapping to some subset of a collection.

The Set is the center of the Fauna API. A Set is an unbounded series of values that can be filtered, transformed, sorted, paged through, aggregated, and otherwise manipulated using the Set methods.

Sets are mainly returned by members on Collection singletons. Every Collection has an all() method, which returns the set of all documents in the Collection ordered by ID. If a Collection has Indexes defined on it, query access to those indexes is by collection methods. Calling a Collection index method returns a Set.

Set methods

FQL enables you to iterate over a result set to compose complex projections or make updates to multiple documents.

The Set methods are of two kinds:

  • Methods that return a lazily modified Set but otherwise do no read operations.

  • Methods that evaluate or partially evaluate the computation built up through lazy set manipulation and return a concrete result.

For uniformity and interoperability between Sets and Arrays, all methods on Sets can also be used with Arrays. The toArray() and toSet() methods can be used to cast between data types.


If a Set is returned from a query, it is rendered into a page of results that includes a subset of the set data and a pagination cursor.

Set methods allow elements to be pulled from a Set and into a type that is not paginated.

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email

Thank you for your feedback!