Credential.firstWhere()
Get the first matching accessible Credential.
Description
Each identity in a Fauna database has a Credential
document. This method
returns the first accessible document that matches the predicate function.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
pred |
Yes |
An anonymous function that compares values in each |
Return value
One of:
Type | Description |
---|---|
First accessible document matching the predicate function. |
|
When no matches are found to the predicate function or all matching documents are inaccessible. See NullDoc. |
Examples
Credential.firstWhere(.document == Customer.byId("111"))
{
id: "371153420791316514",
coll: Credential,
ts: Time("2099-07-24T17:05:34.890Z"),
document: Customer("111")
}
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!