Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

Collection.where()

Get a Set of collection definitions that match a provided predicate.

Signature

Collection.where(pred: (CollectionDef => Boolean)) => Set<CollectionDef>

Description

Gets a Set of collection definitions, represented as Collection documents, that match a provided predicate function.

Collection documents are FQL versions of a database’s FSL collection schema. Collection documents have the CollectionDef type. See Collections.

If this method is the last expression in a query, the first page of the Set is returned. See Pagination.

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

pred

Predicate function

Yes

Anonymous predicate function that:

The method returns a Set of Collection documents for which the predicate returns true.

Return value

Type Description

Set<CollectionDef>

Set of Collection documents that match the predicate. If there are no matching documents, the Set is empty.

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!