<!-- llms-explorer concept facts · https://llms-explorer.com/tree/collation-based-case-insensitive-equality/ · pack 2026-10-24 · ~1128 tokens -->

# Collation-based case-insensitive equality

> Source-anchored research for Collation-based case-insensitive equality. Run status: COMPLETED.

Parent: [MongoDB Query Shape Optimization: Sort, Pagination, Operators and Sharded Targeting](https://llms-explorer.com/tree/mongodb-query-shape-optimization-sort-pagination-operators-and-sharded-targeting/) · 3 facets · 12 facts · page: https://llms-explorer.com/tree/collation-based-case-insensitive-equality/

## How it works

- A case-insensitive regex is not a substitute for collated equality when the requirement is whole-string equality. MongoDB's regex operator is not collation-aware, and a case-insensitive index does not provide the intended regex optimization. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/index-case-insensitive.md)

## Problems, failure modes and limitations

- An operation's effective collation must match the index collation for indexed string comparisons. Two collations can both ignore case yet remain incompatible: the manual's strength-1 query cannot use its strength-2 string index. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/index-case-insensitive.md)
- One collation applies to the entire operation. A find with sort cannot choose separate collations for filtering and sorting, and individual fields cannot receive different collations within that operation. (high confidence) — [source](https://www.mongodb.com/docs/manual/reference/collation.md)

## Facts and statements

- For whole-string case-insensitive equality, create an index such as {name:1} with collation {locale:'en',strength:2}, and issue find({name:'Alice'}).collation({locale:'en',strength:2}). Matching collation makes that index eligible for the string comparison. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/index-case-insensitive.md)
- Queries and indexes inherit the collection's default collation unless they explicitly override it. An index-level collation does not become the query default; on a collection without that default, the query must specify the matching collation. (high confidence) — [source](https://www.mongodb.com/docs/manual/core/index-case-insensitive.md)
- With caseLevel:false, strength:1 compares base characters and ignores case and diacritics; strength:2 also distinguishes secondary differences such as diacritics. Setting caseLevel:true reintroduces case comparisons at either strength, so strength alone does not fully specify case-insensitive behavior. (low confidence) — [source](https://www.mongodb.com/docs/manual/reference/collation.md)
- In an April 2, 2020 Parse Server incident report, adding case-insensitive indexes coincided with regex queries selecting them and running approximately four times slower; the reporter said hinting the existing case-sensitive index restored prior timings. This is historical workload evidence, not a current universal slowdown factor. (low confidence) — [source](https://github.com/parse-community/parse-server/issues/6559)
- Spring Data warns that MongoDB's automatic collection creation on first interaction does not apply an entity's annotated collation. Applications relying on that collection default should create the collection explicitly through MongoOperations.createCollection. (low confidence) — [source](https://docs.spring.io/spring-data/mongodb/reference/mongodb/collation.html)
- Collation-aware indexes store ICU collation keys, which can be larger than keys in indexes without collation. Index eligibility therefore does not imply identical index storage costs. (low confidence) — [source](https://www.mongodb.com/docs/manual/reference/collation.md)
- An equality predicate can match case variants using collation; MongoDB demonstrates {type: "apple"} with {locale: "en", strength: 2} matching apple, Apple, and APPLE. (medium confidence) — [source](https://www.mongodb.com/docs/manual/core/index-case-insensitive.md)
- With caseLevel disabled, strength 2 ignores case while retaining secondary differences such as accents; strength 1 ignores secondary differences too. Locale tailoring can classify some accented letters as primary differences. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/collation.md)
- Setting caseLevel: true restores case distinctions at strengths 1 and 2; specifying a low strength alone therefore does not guarantee case-insensitive equality. (medium confidence) — [source](https://www.mongodb.com/docs/manual/reference/collation.md)
