Operators

Comparison, logical, arithmetic, and bitwise operators for building powerful query conditions.

All Operators

Comparison

== != Equality check
status == "active"
< <= > >= Range comparison
age >= 18
IN Value in array
city IN ["Paris", "London"]
LIKE =~ !~ Pattern & Regex
name LIKE "J%" email =~ "^[a-z]+@"
~= Fuzzy Match (edit distance ≤ 2)
name ~= "jonathen" -- matches: john, jon, jonathan

Logical

AND OR Boolean logic
age > 18 AND active == true
NOT Negation
NOT is_deleted
?? Null coalesce
name ?? "Unknown" -- Returns left if NOT null
|| Logical OR (falsy coalesce)
value || "default" -- Returns left if truthy

Arithmetic

+ - * / Basic operations
total * 1.2
% Modulo (remainder)
index % 2 == 0

Bitwise

& | ^ ~ Logic & NOT
flags & 4 -- Check bit mask | 1 -- Set bit
<< >> Shift Left/Right
1 << 2 -- Results in 4

Array Operators

NEW

Quantifiers allow you to check if conditions apply to elements within an array. These are essential for querying nested data.

ANY At least one match
FILTER ANY item IN doc.items
SATISFIES item.price > 100
True if one or more elements satisfy the condition.
ALL Every element matches
FILTER ALL tag IN doc.tags
SATISFIES tag != "deprecated"
True if every element satisfies the condition (or array is empty).
NONE No matches
FILTER NONE user IN doc.admins
SATISFIES user.status == "inactive"
True if zero elements satisfy the condition.

Syntax Breakdown

QUANTIFIER
ANY / ALL / NONE
VARIABLE
Loop variable
ARRAY
IN doc.items
CONDITION
SATISFIES expr

Bind Variables

SECURITY ESSENTIAL

Prevent Injection Attacks

Never concatenate user input directly into query strings. Always use bind variables (@variable) to safely substitute values.

Query

FOR u IN users
  FILTER u.name == @name
  AND u.age >= @minAge
  RETURN u

Bind Vars

{
  "name": "Alice",
  "minAge": 25
}

Dynamic Field Access

Use bracket notation with bind variables for dynamic field names.

FILTER doc[@fieldName] == @value