Or
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, ...)
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" }))
Examples
The query below returns true
because at least one of the provided
values is "true".
client.Query(Or(true, true, false));
true
curl https://db.fauna.com/ \
-u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
-d '{ "or": [ true, true, false ] }'
HTTP/1.1 200 OK
{ "resource": true }
result, _ := client.Query(f.Or(true, true, false))
fmt.Println(result)
true
System.out.println(
client.query(Or(Value(true), Value(true), Value(false)))
.get());
true
client.query(q.Or(true, true, false))
.then((ret) => console.log(ret))
true
client.query(q.or_(True, True, False))
true
client.query(Or(true, true, false))
true
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!