SDBQL Reference
Master the SoliDB Query Language (SDBQL). A powerful, declarative language for querying and manipulating your JSON documents with graph traversal, aggregations, and 60+ built-in functions.
Quick Example
-- Query with filtering, sorting, and transformation
FOR user IN users
FILTER user.age >= 18 AND user.status == "active"
SORT user.created_at DESC
LIMIT 10
RETURN {
name: user.name,
email: user.email,
member_since: DATE_FORMAT(user.created_at, "%Y-%m-%d")
}
Documentation Sections
Syntax & Basics
FOR/FILTER/SORT/RETURN clauses, LET bindings, subqueries, pipeline operator, null coalescing, optional chaining, CASE expressions, template strings, and window functions.
Operators
Comparison (==, !=, <, >), logical (AND, OR, NOT), arithmetic (+, -, *, /), bitwise operations, pattern matching (LIKE, =~), and fuzzy matching (~=).
Data Mutations
INSERT, UPDATE, UPSERT, and REMOVE operations. Bind variables for parameterized queries. Batch operations and conditional updates.
Graph Queries
Graph traversal with OUTBOUND, INBOUND, ANY directions. Variable depth traversal, shortest path algorithms, and edge filtering.
Aggregations
COLLECT for grouping, AGGREGATE for computing SUM, AVG, COUNT, MIN, MAX. Statistical functions like VARIANCE, STDDEV, MEDIAN, PERCENTILE.
Functions (60+)
String, Date/Time, Numeric, Array, Object, Geospatial, Fulltext search, Type checking, and more. Browse by category.
Function Categories
Basic Query Structure
-- Basic structure
FOR variable IN collection -- Iterate over documents
FILTER condition -- Filter documents
SORT field ASC|DESC -- Sort results
LIMIT count -- Limit results
RETURN expression -- Return transformed data
-- With LET bindings
LET staticValue = expression
FOR doc IN collection
LET computed = UPPER(doc.name)
RETURN { original: doc.name, upper: computed }
-- Multiple FOR clauses (joins)
FOR user IN users
FOR order IN orders
FILTER order.user_id == user._key
RETURN { user: user.name, order: order.total }
Clause Order
- LET (optional, before FOR)
- FOR (required)
- FILTER (optional, multiple allowed)
- SORT (optional)
- LIMIT (optional)
- RETURN (required)
Key Features
- • Pipeline operator:
|> - • Null coalescing:
?? - • Optional chaining:
?. - • Fuzzy matching:
~= - • Template strings:
$"Hello ${name}"