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, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions.

And

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

And(value_1, value_2, ...)
and_(value_1, value_2, ...)
And(value_1, value_2, ...)
And(value_1, value_2, ...)
And(value_1, value_2, ...)

Description

The And function computes the conjunction of a list of boolean values, returning true if all elements are "true", and false otherwise.

Prior to version 3.0.0, all items in the value list were evaluated. With version 3.0.0, evaluation is short-circuited when a false value is encountered. For example, a collection is no longer created with this query:

And(false, CreateCollection({ name: "test" }))
And does not support parameters that include objects, arrays, pages, sets, or expressions. The similar All function supports arrays, pages, and sets.

Parameters

Parameter Type Definition and Requirements

value

Boolean

One or more Boolean values.

Returns

A Boolean value.

Examples

The following query returns false because the last argument is "false":

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

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
false
try
{
    Value result = await client.Query(
        And(true, true, false)
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
BooleanV(False)
And(true, true, false)
false
Query metrics:
  •    bytesIn:  25

  •   bytesOut:  18

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 4ms

  •    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!