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. The Collection.where()
method gets the Set of accessible collection
objects that match the predicate function.
If Collection.where()
is the last value in a query, the first page
of the Set is returned.
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 |
---|---|---|---|
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. The method returns the empty Set if there are no matching collections. |
Examples
Collection.where(.name.includes('Prod'))
{
data: [
{
name: "Product",
coll: Collection,
ts: Time("2099-04-10T17:01:11.995Z"),
...
}
]
}
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!