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.

Or

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

Or(value_1, value_2, ...)
or_(value_1, value_2, ...)
Or(value_1, value_2, ...)
Or(value_1, value_2, ...)
Or(value_1, value_2, ...)

Description

The Or function operates on one or more values and returns true if at least one of the values is "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 true value is encountered. For example, a collection is no longer created with this query:

Or(true, CreateCollection({ name: "test" }))
Or does not support parameters that include Objects, Arrays, Pages, Sets, or FQL expressions. The similar Any function supports Arrays, Pages, and type:[]sets.

Parameters

Parameter Type Definition and Requirements

value

Boolean

One or more Boolean values.

Returns

A Boolean value.

Examples

The following query returns true because at least one of the provided values is "true":

client.query(
  q.Or(true, true, false)
)
.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.or_(True, True, False)
)
print(result)
True
result, err := client.Query(
	f.Or(true, true, false))

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

  •   bytesOut:  17

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