$toUpper

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

Reference group: String aggregation expressions

What it does

Converts a string to uppercase.

Syntax

{$toUpper: stringExpr}

Use case

Normalize codes and labels.

$toUpper: practical example
{ $project: { code: { $toUpper: "$countryCode" } } }
💡 Explanation Converts a string to uppercase. When to use it Normalize codes and labels.
Key Takeaways
  • Converts a string to uppercase.
  • Typical use: Normalize codes and labels.