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

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

  1. LET (optional, before FOR)
  2. FOR (required)
  3. FILTER (optional, multiple allowed)
  4. SORT (optional)
  5. LIMIT (optional)
  6. RETURN (required)

Key Features

  • • Pipeline operator: |>
  • • Null coalescing: ??
  • • Optional chaining: ?.
  • • Fuzzy matching: ~=
  • • Template strings: $"Hello ${name}"