Skip to content

Querying Data

FlintDB queries are JSON objects. Each query targets a collection and can include filtering, sorting, grouping, and aggregation.

{
"collection": "collectionName",
"filter": { ... },
"sort": { "field": "asc" | "desc" },
"limit": 10,
"select": ["field1", "field2"]
}

Filter documents by field values:

{
"collection": "orders",
"filter": { "status": "shipped", "total": { "$gt": 100 } }
}
OperatorDescription
$gtGreater than
$gteGreater than or equal
$ltLess than
$lteLess than or equal
$neNot equal
$inIn array

Sort results by one or more fields:

{
"collection": "products",
"sort": { "price": "desc" }
}

Group documents and compute aggregates per group:

{
"collection": "sales",
"groupBy": "region",
"aggregate": {
"totalRevenue": { "sum": "amount" },
"orderCount": { "count": true }
}
}
{
"collection": "logs",
"sort": { "timestamp": "desc" },
"limit": 50
}