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. |
Token.all()
Signature
Token.all() => Set<Token>
Token.all(range: { from: Any } | { to: Any } | { from: Any, to: Any }) => Set<Token>
Description
Gets a Set containing all tokens, represented
as Token
documents, for the database.
To limit the returned Set, you can provide an optional range.
If this method is the last expression in a query, the first page of the Set is returned. See Pagination.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
range |
|
Specifies a range of The Set only includes documents in this range (inclusive). Omit If a range is omitted, all tokens are returned. |
Range parameters
Name | Type | Required | Description |
---|---|---|---|
|
Beginning of the range (inclusive). Must be an
|
||
|
End of the range (inclusive). Must be an
|
Return value
Type | Description |
---|---|
Set of The Set is empty if:
|
Examples
Range examples
-
Get all tokens for the database:
Token.all()
{ data: [ { id: "123", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("111") }, { id: "456", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("222") }, { id: "789", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("333") } ] }
-
Given the previous Set, get all tokens starting with ID
456
(inclusive):Token.all({ from: Token.byId("456") })
{ data: [ { id: "456", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("222") }, { id: "789", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("333") } ] }
-
Get a Set of tokens from ID
456
(inclusive) to789
(inclusive):Token.all({ from: Token.byId("456"), to: Token.byId("789") })
{ data: [ { id: "456", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("222") }, { id: "789", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("333") } ] }
-
Get a Set of tokens up to ID
789
(inclusive):Token.all({ to: Token.byId("456") })
{ data: [ { id: "123", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("111") }, { id: "456", coll: Token, ts: Time("2099-06-25T13:32:39.240Z"), document: Customer("222") } ] }
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!