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
Example01
Loading editor…
📘 Additional Data Setup — students2 Collection
Example02
Loading editor…
📗 Date Setup — students3 Collection
Example03
Loading editor…
1️⃣ $toString — Convert Age to String
Example04
Loading editor…
2️⃣ $toUpper — Convert to Uppercase
Example05
Loading editor…
3️⃣ $toLower — Convert to Lowercase
Example06
Loading editor…
4️⃣ $strLenBytes — Byte Length of String
Example07
Loading editor…
5️⃣ $strLenCP — Code Point Length
Example08
Loading editor…
6️⃣ $strcasecmp — Case-Insensitive Comparison
Example09
Loading editor…
7️⃣ $substr — Deprecated Substring
Example10
Loading editor…
8️⃣ $substrBytes — Byte-Based Substring
Example11
Loading editor…
9️⃣ $substrCP — Code Point Substring
Example12
Loading editor…
🔟 $replaceOne — Replace First Match
Example13
Loading editor…
1️⃣1️⃣ $replaceAll — Replace All Matches
Example14
Loading editor…
1️⃣2️⃣ $concat — Combine Strings
Example15
Loading editor…
1️⃣3️⃣ $split — Split String into Array
Example16
Loading editor…
1️⃣4️⃣ $ltrim — Left Trim
Example17
Loading editor…
1️⃣5️⃣ $rtrim — Right Trim
Example18
Loading editor…
1️⃣6️⃣ $trim — Trim Both Sides
Example19
Loading editor…
1️⃣7️⃣ $dateFromString — Convert String to Date
Example20
Loading editor…
1️⃣8️⃣ $dateToString — Convert Date to String
Example21
Loading editor…
1️⃣9️⃣ $indexOfBytes — Find Byte Position
Example22
Loading editor…
2️⃣0️⃣ $indexOfCP — Find Code Point Position
Example23
Loading editor…
2️⃣1️⃣ $regexFind — Find First Regex Match
Example24
Loading editor…
2️⃣2️⃣ $regexFindAll — Find All Regex Matches
Example25
Loading editor…
2️⃣3️⃣ $regexMatch — Regex Test
Example26
Loading editor…
Finished this lesson?
Mark it as complete to track your progress and see technology completion stats.