$literal

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

Reference group: Utility expressions and variables

What it does

Treats a value literally rather than interpreting a leading $ as a field path.

Syntax

{$literal: value}

Use case

Output strings that resemble field references.

$literal: practical example
{ $project: { literalText: { $literal: "$notAField" } } }
💡 Explanation Treats a value literally rather than interpreting a leading $ as a field path. When to use it Output strings that resemble field references.
Key Takeaways
  • Treats a value literally rather than interpreting a leading $ as a field path.
  • Typical use: Output strings that resemble field references.