Aggregate
cockpit.aggregate
ActionBusiness appsconnection required
Calls the Cockpit API with the connection's credentials.
Run a MongoDB aggregation pipeline over a collection or tree model.
Connection
- Required
- Yes — the node will not save without one
- Auth type
- API key
- Providers
- Cockpit
- Secret shape
- the API key, or {"api_key": "…"}
- Config it needs
- base_url, locale
- Resolved by
- config.connection_id, else node.connection_id
Configuration
4 fields, 2 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.
| Field | Type | Required | Default | Constraints | Example |
|---|---|---|---|---|---|
model Name of the Cockpit model to work with, as it appears in the admin UI. | string | Yes | — | — | posts |
pipeline The aggregation stages to run, in order. Cockpit prepends its own published-state match and refuses the $out and $merge stages. | array | Yes | — | ≥ 1 characters; array of object | [{"$group":{"_id":"$category","count":{"$sum":1}}}] |
populate How many levels of linked content items to resolve; 0 leaves links as ids. | number | No | 0 | ≥ 0 | — |
locale Locale to return content for; leave blank to use the connection's locale. | string | No | — | — | default |
Example configuration
Every value below is the contract’s own example or default — nothing invented.
{
"locale": "default",
"model": "posts",
"pipeline": [
{
"$group": {
"_id": "$category",
"count": {
"$sum": 1
}
}
}
],
"populate": 0
}Output
One shape.
result
| Field | Type | Example |
|---|---|---|
model The model that was read. | string | — |
items The published items Cockpit returned. | array | — |
count How many items are in this response. | number | — |
total Total matching items when Cockpit reported a paged total. | number | — |
{
"count": 0,
"items": [],
"model": "",
"total": 0
}Related Cockpit nodes
See Aggregate run in a workflow.
In a technical demo we add the Cockpit connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.