Skip to content

Advanced Query Examples

Explore powerful features like nested collection filtering, filtered includes, and flattened projections.

Nested Collection Filtering

Find customers who have at least one order with a total greater than 500.

DSL: ?filter=orders:any:total:gt:500JQL: ?query=orders.any(total > 500)

Filtered Includes

Include only "Cancelled" orders for the returned customers. This shapes the data without filtering the customers themselves.

Query: ?include=orders(status = 'Cancelled')

Grouping and Aggregates

Group by category and status, returning the total sum and count.

Query: ?group=category,status&select=category,sum(total),count(id)&having=sum(total):gt:10000

Flat-Mixed Reporting

Create a flat list of order items including the customer name and order status for each item.

Query: ?select=name as customerName,orders.status,orders.orderItems.productName,orders.orderItems.price&mode=flat-mixed

Resulting Shape:

json
[
  { 
    "customerName": "John", 
    "status": "Shipped", 
    "productName": "Laptop", 
    "price": 1200 
  },
  { 
    "customerName": "John", 
    "status": "Shipped", 
    "productName": "Mouse", 
    "price": 25 
  }
]

Released under the MIT License.