Key.firstWhere()
Get the first key matching a provided predicate.
Description
Gets the first Key
document that
matches a provided predicate
function.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
pred |
Yes |
Anonymous predicate function that:
The method returns the first |
Examples
Key.firstWhere(.role == "admin")
{
id: "412655134325080576",
coll: Key,
ts: Time("2099-07-19T20:53:15.250Z"),
role: "admin",
data: {
desc: "Admin key for prod app database"
}
}
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!