Singleton
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
Singleton( ref )
singleton( ref )
Singleton( ref )
Singleton( ref )
Singleton( ref )
Singleton( ref )
Description
The Singleton
function produces a set containing the Reference that
you provide.
In most cases, functions cast References into sets when necessary. The
only case where Singleton
is required is to return a set’s events
rather than a Reference’s events.
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
Reference |
A reference to a resource, such as a document, collection, database, etc. |
Examples
The following query creates a single-item set from the provided ref
:
Singleton(Ref(Collection("posts"), "233286601218720256"))
SetRef({'singleton': Ref(id=233286601218720256, collection=Ref(id=posts, collection=Ref(id=collections)))})
{map[singleton:{233555580689580553 0xc00009b410 0xc00009b410 <nil>}]}
SetRefV(System.Collections.Generic.Dictionary`2[System.String,FaunaDB.Types.Value])
{@set = {singleton: ref(id = "233286601218720256", collection = ref(id = "posts", collection = ref(id = "collections")))}}
Singleton(Ref(Collection("posts"), "233286601218720256"))