Singleton
Copied!
Singleton( ref )
Description
The Singleton
function produces a set containing the ref that you
provide.
In most cases, functions cast refs into sets when necessary. The only
case where Singleton
is required is to return a set’s events
rather than a ref’s events.
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
Ref |
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:
Copied!
client.query(
q.Singleton(q.Ref(q.Collection('posts'), '233286601218720256'))
)
.then((ret) => console.log(ret))
SetRef({ singleton: Ref(Collection("posts"), "233286601218720256") })
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!