Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/docs/data-modeling/queries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@ transparent to the query — you get the same buckets either way.
<Callout type="warn">
Buckets are computed in **UTC**. A non-UTC reference timezone is only reachable through
`ObjectQL.aggregate(object, { …, timezone })`; the `POST /api/v1/data/:object/query`
route forwards only `where` / `groupBy` / `aggregations`, so a query sent over REST
always buckets on UTC calendar boundaries.
route does not forward `timezone` to the engine, so a query sent over REST always
buckets on UTC calendar boundaries.

The optional `alias` on a structured `groupBy` node is honoured only on the in-memory
path. The SQL driver ignores it and always projects the bucket under the **field name**,
Expand Down
11 changes: 4 additions & 7 deletions content/docs/kernel/contracts/data-engine.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,11 @@ const result = await engine.aggregate('task', {

### EngineAggregateOptions

```typescript
interface EngineAggregateOptions {
where?: FilterCondition; // Pre-aggregation filter (WHERE)
groupBy?: string[]; // GROUP BY fields
aggregations?: AggregationNode[]; // Aggregation definitions
context?: ExecutionContext;
}
The option keys are listed in the generated
[`EngineAggregateOptions` reference](/docs/references/data/data-engine#engineaggregateoptions).
`aggregations` takes `AggregationNode` entries:

```typescript
interface AggregationNode {
function: 'count' | 'sum' | 'avg' | 'min' | 'max' | 'count_distinct';
field?: string; // Field to aggregate (optional for COUNT(*))
Expand Down
7 changes: 4 additions & 3 deletions content/docs/protocol/objectql/query-syntax.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1334,9 +1334,10 @@ const products = await engine.find('product', {
### Analytics: Revenue by Month

`month` is not a column — bucket the `created_at` instant with `dateGranularity`. Note
that `engine.aggregate()` accepts only `where` / `groupBy` / `aggregations` (plus a
`timezone` for bucketing): there is no `orderBy` or `limit` on this path, so sort the
returned rows yourself.
that `engine.aggregate()` takes a closed option set with no `orderBy` or `limit` (the
full list is under `EngineAggregateOptions` in the
[Data Engine reference](/docs/references/data/data-engine)), so sort the returned rows
yourself. It does carry a `timezone` for bucketing.

```typescript
const monthlyRevenue = await engine.aggregate('order', {
Expand Down
Loading