$concat

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

Reference group: String aggregation expressions

What it does

Concatenates strings; null inputs can yield null, so use $ifNull when needed.

Syntax

{$concat: [stringExpr, ...]}

Use case

Build display labels.

$concat: practical example
{ $project: { fullName: { $concat: ["$firstName", " ", "$lastName"] } } }
💡 Explanation Concatenates strings; null inputs can yield null, so use $ifNull when needed. When to use it Build display labels.
Key Takeaways
  • Concatenates strings; null inputs can yield null, so use $ifNull when needed.
  • Typical use: Build display labels.