FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.

For more details, review the migration guide. Contact support@fauna.com with any questions.

Equals

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

Equals(value_1, value_2, ...)
equals(value_1, value_2, ...)
Equals(value_1, value_2,...)
EqualsFn(value_1, value_2, ...)
Equals(value_1, value_2, ...)

Description

The Equals function tests equivalence between a list of values.

Two functions are considered equal if their syntax is identical. For example:

Equals(Query(Lambda('a', 5)), Query(Lambda('a', 5)))
true

Parameters

Parameter Type Definition and Requirements

value_1

Any

A single value.

value_2

Any

A single value.

…​

Any

Optional - Any number of additional values to compare for equality.

Returns

true when all provided parameters are equal, false otherwise.

Examples

The following query returns true because fire is equivalent to fire.

client.query(
  q.Equals('fire', 'fire')
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
true
result = client.query(
  q.equals("fire", "fire")
)
print(result)
True
result, err := client.Query(
	f.Equals("fire", "fire"))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
true
try
{
    Value result = await client.Query(
        EqualsFn("fire", "fire")
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
BooleanV(True)
Equals('fire', 'fire')
true
Query metrics:
  •    bytesIn:  26

  •   bytesOut:  17

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 3ms

  •    retries:   0

The following query returns true because null values (and their equivalents) are equal to themselves:

client.query(
  q.Equals(null, null)
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
true
result = client.query(
  q.equals(None, None)
)
print(result)
True
result, err := client.Query(
	f.Equals(nil, f.Null()))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
true
try
{
    Value result = await client.Query(
        EqualsFn(Null(), Null())
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
BooleanV(True)
Equals(null, null)
true
Query metrics:
  •    bytesIn:  22

  •   bytesOut:  17

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 1ms

  •    retries:   0

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!