Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-92900

Cannot build index with simple collation on a collection with a non-default collator if an index already exists with the collection's collator

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 7.2.0, 7.3.0, 8.1.0-rc0, 8.0.0-rc9
    • Component/s: None
    • None
    • Catalog and Routing
    • ALL
    • v8.0
    • CAR Team 2024-08-05

      When creating an index with simple collation, the simple collation is removed from the index spec here. Then, the normalization added by SERVER-81890 here will add the collection's default collation to the index spec.

      This means that when building an index with a simple collation, this index spec will compare as equal to one with the collection's default collator and so no new index will be created if there is already an index on the same key with the collection's default collation.

      This also has the side effect of causing us not to create a shard key index in some circumstances since the shard key index must have simple collation. So if an index already exists on the shard key with the default collation, we will end up with a sharded collection missing the shard key index.

        1. repro.js
          0.8 kB
          Allison Easton

            Assignee:
            jordi.olivares-provencio@mongodb.com Jordi Olivares Provencio
            Reporter:
            allison.easton@mongodb.com Allison Easton
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: