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.

Credential.where()

Learn: Credentials

Get a Set of credentials that match a provided predicate.

Signature

Credential.where(pred: (Credential => Boolean)) => Set<Credential>

Description

Gets a Set of credentials, represented as Credential documents, that match a provided predicate function.

A credential associates a password with an identity document. You can use credentials and the credential.login() method to create tokens as part of an end-user authentication system.

If Credential.where() is the last expression in a query, the first page of the Set is returned. See Pagination.

Parameters

Parameter Type Required Description

pred

Predicate function

Yes

Anonymous predicate function that:

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

Return value

Type Description

Set<Credential>

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

Examples

Credential.where(.document == Customer.byId("111"))
{
  data: [
    {
      id: "412654807560487424",
      coll: Credential,
      ts: Time("2099-08-11T04:25:08.950Z"),
      document: Customer("111")
    }
  ]
}

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!