Key.where()
Get the Set of accessible keys in the database.
Signature
Key.where(predicate: () => Boolean)): Set<Key>
Key.where(predicate: (val: Key) => Boolean)): Set<Key>
Description
Each Key in a Fauna database is represented by a Key
object. Key.where()
gets the Set of accessible Key
objects that match the predicate function.
The predicate function must return a Boolean.
If Key.where()
is the last value in a query, the first page
of the Set is returned.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
predicate |
An anonymous function that compares values in each |
Examples
{
data: [
{
id: "370714759876575266",
coll: Key,
ts: Time("2023-07-19T20:53:15.250Z"),
role: "admin",
data: {
name: "coffee-admin"
}
},
{
id: "371460335192768546",
coll: Key,
ts: Time("2023-07-28T02:25:35.050Z"),
role: "humanResources",
data: {
foo: "bar"
}
}
]
}
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!