Aggregations

The full aggregation framework, run on the ranges that hold the data.

TeselaDB runs the MongoDB 9.0 aggregation framework: every stage, expression, accumulator and window operator, $lookup, $facet, $unionWith, $out, $merge and updates with a pipeline.

JavaScript
db.orders.aggregate([
  { $match: { status: "paid", created: { $gte: ISODate("2026-10-01") } } },
  { $group: { _id: "$customer", total: { $sum: "$total" }, orders: { $count: {} } } },
  { $sort: { total: -1 } },
  { $limit: 10 },
]);

How it is split

The router sends each range the part of the pipeline it can do alone ($match, $project, partial aggregates of $group, the top-k of $sort with $limit) and merges the results. Stages that need more memory than is available spill to disk.

explain

explain has MongoDB's shape and adds its own stages: the ranges touched, the bucket merge of an index with teselaBuckets, the split between ranges and the spills to disk.

JavaScript
db.orders.find({ customer: "Ana Ruiz" }).explain("executionStats");

What changes from MongoDB

The planner chooses by cost and may pick a different index than MongoDB for the same query. explain and the order of results of a query without sort change, never which documents are returned.