-
Type: New Feature
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Linq
-
None
Syntax
{$substrBytes: <expression>} {$substrCP: <expression>}
Examples
Input
{_id: 0, string: "ελληνικά"}
Pipeline
db.coll.aggregate([{ $project: { byteSubstr: {$substrBytes: ["$string", 0, 4]}, cpSubstr: {$substrCP: ["$string", 0, 4]} } }])
Output
{_id: 0, byteSubstr: "ελ", cpSubstr: "ελλη"}
Additional Notes
- Will not add any new query functionality to work with strings.
- $substrBytes will error if it starts or ends in the middle of a code point.
- $substrCP will error on any input that is detected to be invalid UTF-8.
- depends on
-
SERVER-22580 Add $cpLength and $cpSubstr expressions which work via code points
- Closed
- is depended on by
-
DRIVERS-297 Aggregation Framework Support for 3.4
- Closed