$strcasecmp
Reference group: String aggregation expressions
What it does
Compares strings case-insensitively and returns negative, zero, or positive.
Syntax
{$strcasecmp: [string1, string2]}
Use case
Compare without changing case.
$strcasecmp: practical example
{ $project: { cmp: { $strcasecmp: ["$storedCode", "abc"] } } }💡 Explanation
Compares strings case-insensitively and returns negative, zero, or positive.
When to use it
Compare without changing case.
Key Takeaways
- Compares strings case-insensitively and returns negative, zero, or positive.
- Typical use: Compare without changing case.