For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to page URLs.
Skip to content

Aggregates

Saved MongoDB aggregation pipelines that your app runs by id.

Where: Database → Aggregates · /projects/<project>/db/aggregates

An aggregate is a saved MongoDB aggregation pipeline for one collection: it groups, counts, joins and reshapes records. Your app runs it by its id (maggr_…), so you can change the pipeline in Cloud without a new app release.

Aggregates list with the columns ID, Name and Schema and one row: maggr_5W9f2eefrp0I3UwXVxDP2o, Books per genre, books; Add New at the top right
Database → Aggregates.

Columns, search and filters

Column
What it shows

ID

The aggregate id (maggr_5W9f2eefrp0I3UwXVxDP2o) — the one your app passes to executeAggregate. Click it to open the editor.

Name

The name.

Schema

The collection the pipeline runs on.

The list has no search or filters. Reading needs database:read on the aggregates of a schema (database:aggregate:<schemaId>); creating and changing need database:create / database:update there.

What you can do here

Running an aggregate needs database:read on its collection and on every collection the pipeline joins ($lookup, $graphLookup, $unionWith, also nested and inside $facet). Pipelines are read-only: $out, $merge, $where, $function and $accumulator are refused (CM-ERRORS-DATABASE-031) when you save and every time it runs. A schema that an aggregate starts from or joins cannot be deleted (CM-ERRORS-SCHEMA-018).

Do it from code

API: Get Database Aggregates · Execute Aggregate

Last updated