Skip to content

Analytics

Dashboards build charts over your Database collections: line, bar, pie, and table widgets. Schema types are line_chart, bar_chart, pie_chart, and table.

Open Dashboards, create a dashboard, and add a chart. Pick a collection and schema, set the aggregation (the calculated-field control is labeled “Calculated field (optional)”), and place the widget on the grid. About 20 rows are in view before you scroll.

Queries are WidgetQuery aggregations (filters, grouping, time buckets). Run them from the console, POST /api/projects/:projectId/query, or MCP run_query. POST /query parses this shape:

{
"query": {
"sources": [{ "collectionName": "orders" }],
"filters": [{ "field": "status", "operator": "eq", "value": "paid" }],
"aggregations": [{ "function": "percentile", "field": "total", "percentileValue": 0.95, "alias": "p95" }],
"groupBy": { "field": "_createdAt", "timeBucket": "oneDay" },
"calculatedFields": [{ "alias": "ratio", "expression": "errors / total * 100" }],
"timeRange": { "field": "_createdAt" },
"sort": { "field": "p95", "ascending": false },
"limit": 100
}
}
  • Filter operators: eq, neq, gt, gte, lt, lte, isIn, nin, regex, exists. The JSON key is operator.
  • Aggregations: sum, avg, min, max, count, percentile. An omitted percentileValue becomes 0.95. The pipeline uses Mongo $percentile with method: approximate.
  • Time buckets: oneMinute, fiveMinutes, fifteenMinutes, oneHour, sixHours, oneDay, oneWeek, oneMonth.
  • Calculated fields use alias plus an arithmetic expression. Operators are +, -, *, /, evaluated left to right. Parentheses are not supported. A bare field name that was aggregated is rewritten to that aggregation’s alias (sum_value).
  • The sort key is ascending (boolean).
  • Joins and timeSeriesOps (rate, increase, irate, avgOverTime, maxOverTime, minOverTime) exist on the model.

Saved queries should persist timeRange.field. The UI overlays from / to at load time.

Layout uses a 40×100 grid. Widget config is { "name": "...", "dataSets": [ { "collectionName", "tableSchemaId", "query": { ... } } ] }. Table widgets use one dataSet with collection + schema id; they do not take static config.data. Widget config is capped at 65536 bytes.

  • Dashboards per organization: 2 on Free, 50 on Pro, unlimited on Scale.
  • Widgets per dashboard: 20 on Free, 100 on Pro, 200 on Scale.
  • Concurrent queries: 2 on Free, 5 on Pro, 10 on Scale. The gate waits up to 5 seconds, then fails with 429 rate_limited. Results are cached for 30 seconds, shared by dashboards and run_query.

MCP: read kataflax://reference/dashboard-widget-types, then create_dashboard, add_widget, list_dashboards, and delete_dashboard. Prompt: create_analytics_dashboard.