All

Not available in this language yet.
Not available in this language yet.
All( values )
All( values )
Not available in this language yet.
All( values )

Description

The All function tests the provided values and returns true if all of the items in values are true, otherwise it returns false.

When values is an empty Array or Set, All returns true, because values itself is set.

The run time of All is dependent on the number of elements in the underlying set or page (it’s linear, or O(1)). For very large sets or pages, executing All might result in a query timeout error.

To work around this, you may specify a larger query timeout via the driver that you are using.

Parameters

Argument Type Definition and Requirements

values

Array or Set

A group of values to test for being true.

Returns

A boolean indicating whether all of the items in values are true.

Examples

The following query uses All multiple times to demonstrate how the function evaluates several groups of values:

Not available in this language yet.
Not available in this language yet.
System.out.println(
    client.query(
        Arr(
            All(Arr(Value(true), Value(true), Value(true))),
            All(Arr(Value(false), Value(true), Value(true))),
            All(Arr())
        )
    ).get());
[true, false, true]
client.query([
  q.All([true, true, true]),
  q.All([false, true, true]),
  q.All([]),
]).then((ret) => console.log(ret))
[ true, false, true ]
Not available in this language yet.
println(Await.result(
  client.query(
    Arr(
      All(Arr(true, true, true)),
      All(Arr(false, true, true)),
      All(Arr())
    )
  ),
  5.seconds
))
[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!