String Operators

Operator

Description

Example

$concat

Concatenates two or more string properties or expressions in the passed in array.

{“$concat”: [“name.first”, {“$string”: “ ”}, “name.last”]}

$substr

Returns a portion of a string. Takes an array of three elements: source string, integer start index and integer length. The integer values can be literals, properties, or expressions.

{“$substr”: [“c_desc”, 0, 20]}

$toLower

Returns a lowercase version of the string argument.

{“$toLower”: “c_title”}

$toUpper

Returns an uppercase version of the string argument.

{“$toUpper”: “c_title”}

$strcasecmp

Performs a case-insensitive string comparison. Returns 0 if the two passed in array values are equivalent, 1 if the first value is greater than the second, -1 if the second value is greater than the first.

{“$strcasecmp”: [“name.first”, {“$string”: “J”}]}