firstWhere()
Get the first matching value from the Set.
Signature
firstWhere(predicate: () => Boolean | Null): T | Null
firstWhere(predicate: (value: T) => Boolean | Null): T | Null
Description
The firstWhere()
method gets the first matching value from the set, or null
when no values match.
Parameters
Examples
Get the first Customers document where the state
property is DC
:
{
id: "346525880196007424",
coll: Customer,
ts: Time("2022-10-25T21:01:21.910Z"),
firstName: "Alice",
lastName: "Appleseed",
address: {
street: "87856 Mendota Court",
city: "Washington",
state: "DC",
zipCode: "20220"
},
telephone: "208-346-0715",
creditCard: {
network: "Visa",
number: "4556781272473393"
}
}
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!