$strLenBytes
Reference group: String aggregation expressions
What it does
Returns UTF-8 byte length.
Syntax
{$strLenBytes: string}
Use case
Estimate encoded size.
$strLenBytes: practical example
{ $project: { bytes: { $strLenBytes: "$description" } } }💡 Explanation
Returns UTF-8 byte length.
When to use it
Estimate encoded size.
Key Takeaways
- Returns UTF-8 byte length.
- Typical use: Estimate encoded size.