Database.all()

Get the set of all child databases.

Signature

Database.all(): Set<DatabaseDef>

Database.all(range: {from: Any, to: Any}): Set<Database>

Description

The Database.all() method returns the set of all Databases or, optionally, the set of databases in the given range.

If Database.all() is the last expression in a query, the first page of the Set is returned.

Parameters

Parameter Type Required Description

range

Object

Object describing the range.

Returns all members of the set greater than or equal to from and less than or equal to to, including duplicates for an unordered set. If range is omitted, the method returns all Database objects.

range fields

Name Type Required Description

from

Any

Beginning of range.

to

Any

End of range.

Return value

Type Description

Set<DatabaseDef>

All Database objects or objects in the given range.

If the resulting set is empty, the method returns an empty set.

For an ordered set, if from is greater than to, the method returns an empty set.

If the first member of the set is greater than or equal to from and also less than or equal to to only that value is returned.

Examples

Database.all()
{
  data: [
    {
      name: "Growers",
      coll: Database,
      ts: Time("2023-06-05T19:44:23.040Z"),
      global_id: "ywmp5m111yyre",
      typechecked: true,
      priority: 10
    },
    {
      name: "BestOfClass",
      coll: Database,
      ts: Time("2023-06-05T19:46:51.110Z"),
      global_id: "ywmp5wua1yyre",
      typechecked: true,
      priority: 100
    }
  ]
}
Database.all({ from: Database.byName("BestOfClass") })
{
  data: [
    {
      name: "BestOfClass",
      coll: Database,
      ts: Time("2023-06-05T19:46:51.110Z"),
      typechecked: true,
      global_id: "ywmp5wua1yyre",
      priority: 100
    }
  ]
}

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!