Function.where()
Signature
Function.where(predicate: () => Boolean)): <Function>
Function.where(predicate: (val: Function) => Boolean)): <Function>
Description
Each user-defined function (UDF) document in a Fauna database is
represented by a function object. Function.where()
returns the set of
accessible UDF documents that match the predicate function.
The predicate function must return a Boolean.
If Function.where()
is the last value in a query, the first page of the
Set is returned.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
predicate |
Anonymous Function that compares values in each UDF document and
returns |
predicate parameters:
Parameter | Type | Required | Description |
---|---|---|---|
val |
UDF object to compare. If omitted, use dot notation to access Function properties. |
Return value
Type | Description |
---|---|
Set representing the UDF documents that match the predicate Function. See Function document definition. |
Examples
Get the Set of UDF documents that are accessible and match the predicate function:
{
data: [
{
name: "Double",
coll: Function,
ts: Time("2022-10-25T21:01:19.310Z"),
body: "(x) => x + x"
}
]
}
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!