Role.where()
Get the Set of accessible Roles in the database.
Signature
Role.where(predicate: () => Boolean)): Set<Role>
Role.where(predicate: (val: Role) => Boolean)): Set<Role>
Description
Each Role in a Fauna database is represented by a Role
object.
Role.where()
gets the set of accessible roles that match the predicate
function.
The predicate function must return a Boolean. If Role.where()
is the last
value in a query, the first page of the Set
is returned.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
predicate |
Yes |
An anonymous function that compares values in each document and returns
|
Examples
{
data: [
{
name: "humanResources",
coll: Role,
ts: Time("2023-07-21T00:22:25.260Z"),
privileges: {
resource: "People",
actions: {
read: true,
create: "data => data.status == \'active\' "
}
}
}
]
}
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!