$substrCP

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

Reference group: String aggregation expressions

What it does

Extracts by Unicode code-point positions.

Syntax

{$substrCP: [string, start, count]}

Use case

Create text previews.

$substrCP: practical example
{ $project: { preview: { $substrCP: ["$description", 0, 80] } } }
💡 Explanation Extracts by Unicode code-point positions. When to use it Create text previews.
Key Takeaways
  • Extracts by Unicode code-point positions.
  • Typical use: Create text previews.