$toLower
Reference group: String aggregation expressions
What it does
Converts a string to lowercase.
Syntax
{$toLower: stringExpr}
Use case
Normalize values.
Important notes
For case-insensitive search/uniqueness, consider collation and compatible indexes.
$toLower: practical example
{ $project: { emailLower: { $toLower: "$email" } } }💡 Explanation
Converts a string to lowercase.
When to use it
Normalize values.
Caution
For case-insensitive search/uniqueness, consider collation and compatible indexes.
Key Takeaways
- Converts a string to lowercase.
- Typical use: Normalize values.