Boolean Functions

Created by Brian Glick, Modified on Wed, 5 Nov at 5:26 AM by Brian Glick

$boolean

Signature: $boolean(arg)

Parameters:

  • arg - An argument to be cast to a Boolean.

Casts the argument to a Boolean using the following rules:

Argument type Result
Boolean unchanged
string: empty false
string: non-empty true
number: 0 false
number: non-zero true
null false
array: empty false
array: contains a member that casts to true true
array: all members cast to false false
object: empty false
object: non-empty true
function false

​$not

Signature: $not(arg)

Parameters:

  • arg - An argument to be cast to a Boolean and inverted.

Returns Boolean NOT on the argument. arg is first cast to a boolean.

​$exists

Signature: $exists(arg)

Parameters:

  • arg - An argument to chech the existence of.

Returns Boolean true if the arg expression evaluates to a value, or false if the expression does not match anything (e.g. a path to a non-existent field reference).

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article