Check out v4 of the Fauna CLI
v4 of the Fauna CLI is now in beta. The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start. |
Collection.firstWhere()
Get the first collection definition matching a provided predicate.
Description
Gets the first collection definition, represented as a
Collection
document, that matches a provided
predicate function.
Collection
documents are FQL versions of a database’s FSL
collection schema. Collection
documents
have the CollectionDef type. See
Collections.
Staged schema
If a database has staged schema, this method interacts with the database’s staged schema, not the active schema.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
pred |
Yes |
Anonymous predicate function that:
The method returns the first |
Return value
One of:
Type | Description |
---|---|
First |
|
Null |
No |
Examples
Collection.firstWhere(.name.includes('Prod'))
{
name: "Product",
coll: Collection,
ts: Time("2099-04-10T14:13:05.740Z"),
...
}
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!