# Aggregation Expression

*noun*

say it: **“ag-rih-GAY-shun ik-SPRESH-un”** **/ˌæɡrɪˈɡeɪʃən ɪkˈsprɛʃən/**

In a MongoDB pipeline, a small formula, such as $multiply or $round, worked out for each document.

## What is an **aggregation expression**?

An **aggregation expression** is a small formula a stage works out for each document, written as an operator with its inputs, such as `{ $multiply: ["$price", "$qty"] }`. Expressions can go inside each other, such as `$round` around a `$multiply`.

```javascript
db.orderItems.aggregate([
  { $set: { lineTotal: { $round: [{ $multiply: ["$price", "$qty"] }, 2] } } }
]);
// { item: 'Bell', price: 12.49, qty: 3, lineTotal: 37.47, ... }
```

## In a sentence

- “Wrapping one **aggregation expression** in another, $round kept the totals to two decimal places.”
- “The **aggregation expression** $multiply worked out each line's price times its quantity.”

Level: Journeyman · [More MongoDB terms at this level](https://www.ask-codey.com/glossary?category=mongodb&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/aggregation-expression
