Database.where()
| Learn: Databases and multi-tenancy |
|---|
Get a Set of child databases that match a provided predicate.
Description
Gets a Set of child databases,
represented as Database documents,
that match a provided predicate
function.
Fauna stores child databases as documents in the parent database’s
Database system collection.
Database documents have the DatabaseDef type.
If Database.where() is the last expression in a query, the first page of
the Set is returned. See Pagination.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
pred |
Yes |
Anonymous predicate function that:
The method returns a Set of |
Examples
Database.where(.name.includes("child"))
{
data: [
{
name: "childDB",
coll: Database,
ts: Time("2099-06-24T21:54:38.890Z"),
global_id: "ysjpykbahyyr1",
priority: 10,
typechecked: true
},
...
]
}
Database.where(childDB => childDB.priority == 10)
{
data: [
{
name: "childDB",
coll: Database,
ts: Time("2099-06-24T21:54:38.890Z"),
typechecked: true,
global_id: "ysjpykbahyyr1",
priority: 10
},
...
]
}