$multiply

Reference type:Cheat sheetFormat:Syntax + example + use case

Reference group: Arithmetic expressions

What it does

Multiplies numeric values.

Syntax

{$multiply: [expr, ...]}

Use case

Line totals and weighted metrics.

$multiply: practical example
{ $project: { lineTotal: { $multiply: ["$unitPrice", "$quantity"] } } }
💡 Explanation Multiplies numeric values. When to use it Line totals and weighted metrics.
Key Takeaways
  • Multiplies numeric values.
  • Typical use: Line totals and weighted metrics.