Credential.where()

Get the set of accessible Credential in the database.

Signature

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

Credential.where(predicate: (val: Credential) => Boolean)): Set<Credential>

Description

Each credential in a Fauna database is represented by a Credential document. Credential.where() gets the Set of accessible documents that match the predicate function.

Parameters

Parameter Type Required Description

predicate

Function

Yes

An anonymous function that compares values in each Credential document and returns true for matches or false for mismatches.

predicate parameters:

Parameter Type Required Description

val

Credential

Credential document to compare. If omitted, use dot notation to access Credential properties.

Return value

Type Description

type:Set<type:Credential>

Set representing the documents that match the predicate function. If this method is the last value in a query, the method returns the first page of the Set. Returns an empty set if there are no matches.

Examples

Credentials.where(.document == People.byId("372736323915612193"))
{
  data: [
    {
      id: "372736323917709345",
      coll: Credential,
      ts: Time("2023-08-11T04:25:08.950Z"),
      document: People.byId("372736323915612193")
    }
  ]
}

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!