Key.firstWhere()
Get the first matching accessible Key.
Signature
Key.firstWhere(predicate: () => Boolean)): Key | NullKey
Key.firstWhere(predicate: (val: Key) => Boolean)): Key | NullKey
Description
Each key in a Fauna database is represented by a Key
object. This method returns the first accessible key that
matches the predicate function. When no matching keys
exist or are accessible, it returns null
.
The predicate function must return a Boolean.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
predicate |
An anonymous function that compares values in each |
Examples
{
id: "370714759876575266",
coll: Key,
ts: Time("2023-07-19T20:53:15.250Z"),
data: {
name: "coffee-admin"
},
role: "admin"
}
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!