MongoDB String Operators
MongoDB string operators are a set of special operators used to manipulate string type fields, which can be used to perform various processing and conversion operations on strings in both aggregation queries and regular queries. This page compiles the string operators in MongoDB.
-
$concat
The Mongodb$concat
operator is used to concatenate strings. This operator can combine multiple strings into a single string. -
$indexOfBytes
$indexOfBytes
is a string operator in MongoDB used to find the first occurrence of a substring in a string and return its starting position. -
$indexOfCP
$indexOfCP
is a string operator in MongoDB used to find the starting position of a substring within a string. -
$ltrim
The MongoDB$ltrim
operator is used to remove specified characters from the left side of a string. -
$replaceAll
The MongoDB$replaceAll
operator can find and replace all matching substrings within a string. -
$replaceOne
The MongoDB$replaceOne
operator is used to update the first document in a collection that matches the specified condition. -
$rtrim
The MongoDB$rtrim
operator is used to remove specified characters from the end of a string. -
$split
The MongoDB$split
operator is used to split strings and extract specific substrings or split a string into an array. -
$strcasecmp
The$strcasecmp
operator is an aggregation operator used for string comparison in MongoDB. -
$strLenBytes
$strLenBytes
is an aggregation operator in MongoDB that is used to calculate the number of bytes in a string. -
$strLenCP
The$strLenCP
operator is an aggregation operator in MongoDB used to calculate the number of characters in a string. -
$substrBytes
The$substrBytes
operator is a string aggregation operator in MongoDB used to extract a substring from a string. -
$substrCP
$substrCP
is a string aggregation operator in MongoDB used to extract a substring from a string by code point. -
$toLower
The$toLower
operator is a string aggregation operator in MongoDB that converts a string to its lowercase form. -
$toUpper
The Mongodb$toUpper
operator is a string aggregation operator that converts a string to uppercase. -
$trim
The MongoDB$trim
operator is a string aggregation operator used to remove specified characters or whitespace from a string.