MongoDB, the $strLenBytes
aggregation pipeline operator returns the number of UTF-8 encoded bytes in the specified string.
Each character in a string can contain contain a different number of bytes, depending on the character being used. The $strLenBytes
operator can figure out how many bytes each character contains and return the correct result for the whole string.