Collection.where()
Get the Set of accessible collections in the database.
Signature
Collection.where(predicate: () => Boolean)): Set<CollectionDef>
Collection.where(predicate: (val: Collection) => Boolean)): Set<CollectionDef>
Description
Each collection in a Fauna database is represented by a collection
object. Collection.where()
gets the Set of accessible collection
objects that match the predicate function.
The predicate function must return a Boolean.
If where()
is the last value in a query, the first page
of the Set is returned.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
predicate |
Yes |
Anonymous function that compares values in each collection document
and returns |
Return value
Type | Description |
---|---|
Set<CollectionDef> |
Set representing the collections that match the predicate function. Returns the empty set if there are no matching collections. |
Examples
{
data: [
{
name: "testit1",
coll: Collection,
ts: Time("2022-12-28T17:32:01.440Z")
},
{
name: "doesnotexist",
coll: Collection,
ts: Time("2023-02-18T19:22:26.355Z"),
indexes: {},
constraints: []
}
]
}
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!