Nearby lessons
16 of 22🧵 MongoDB: String Operators
MongoDB provides powerful string operators for text manipulation, conversion, formatting, and pattern matching.
These operators are mainly used within the aggregation pipeline to transform or analyze text data efficiently.
📚 Initial Data Setup — students Collection
📘 Additional Data Setup — students2 Collection
📗 Date Setup — students3 Collection
1️⃣ $toString — Convert Age to String
2️⃣ $toUpper — Convert to Uppercase
3️⃣ $toLower — Convert to Lowercase
4️⃣ $strLenBytes — Byte Length of String
5️⃣ $strLenCP — Code Point Length
6️⃣ $strcasecmp — Case-Insensitive Comparison
7️⃣ $substr — Deprecated Substring
8️⃣ $substrBytes — Byte-Based Substring
9️⃣ $substrCP — Code Point Substring
🔟 $replaceOne — Replace First Match
1️⃣1️⃣ $replaceAll — Replace All Matches
1️⃣2️⃣ $concat — Combine Strings
1️⃣3️⃣ $split — Split String into Array
1️⃣4️⃣ $ltrim — Left Trim
1️⃣5️⃣ $rtrim — Right Trim
1️⃣6️⃣ $trim — Trim Both Sides
1️⃣7️⃣ $dateFromString — Convert String to Date
1️⃣8️⃣ $dateToString — Convert Date to String
1️⃣9️⃣ $indexOfBytes — Find Byte Position
2️⃣0️⃣ $indexOfCP — Find Code Point Position
2️⃣1️⃣ $regexFind — Find First Regex Match
2️⃣2️⃣ $regexFindAll — Find All Regex Matches
2️⃣3️⃣ $regexMatch — Regex Test
Keep Going!MongoDB - Date Operators