翻译或纠错本页面
- Reference >
- Operators >
- Aggregation Pipeline Operators >
- String Aggregation Operators
String Aggregation Operators¶
String expressions, with the exception of $concat, only have a well-defined behavior for strings of ASCII characters.
$concat behavior is well-defined regardless of the characters used.
注解
For details on specific operator, including syntax and examples, click on the specific operator to go to its reference page.
| Name | Description |
|---|---|
| $concat | Concatenates any number of strings. |
| $indexOfBytes | Searches a string for an occurence of a substring and returns the UTF-8 byte index of the first occurence. If the substring is not found, returns -1. |
| $indexOfCP | Searches a string for an occurence of a substring and returns the UTF-8 code point index of the first occurence. If the substring is not found, returns -1. |
| $split | Splits a string into substrings based on a delimiter. Returns an array of substrings. If the delimiter is not found within the string, returns an array containing the original string. |
| $strcasecmp | Performs case-insensitive string comparison and returns: 0 if two strings are equivalent, 1 if the first string is greater than the second, and -1 if the first string is less than the second. |
| $strLenBytes | Returns the number of UTF-8 encoded bytes in a string. |
| $strLenCP | Returns the number of UTF-8 code points in a string. |
| $strcasecmp | Performs case-insensitive string comparison and returns: 0 if two strings are equivalent, 1 if the first string is greater than the second, and -1 if the first string is less than the second. |
| $substr | Deprecated. Use $substrBytes or $substrCP. |
| $substrBytes | Returns the substring of a string. Starts with the character at the specified UTF-8 byte index (zero-based) in the string and continues for the specified number of bytes. |
| $substrCP | Returns the substring of a string. Starts with the character at the specified UTF-8 code point (CP) index (zero-based) in the string and continues for the number of code points specified. |
| $toLower | Converts a string to lowercase. Accepts a single argument expression. |
| $toUpper | Converts a string to uppercase. Accepts a single argument expression. |
