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

Add 'unique' and 'sparse' parameters to index signature

    • Fully Compatible
    • Query Execution 2021-02-22, Query Execution 2021-03-08
    • 40

      At present, an index's signature - that is, the combination of parameters which uniquely identify the index - is defined by its keypattern and collation. No index can be created if its signature is equivalent to an existing index. SERVER-25023 seeks to add the partialFilterExpression parameter to this list, such that multiple partial indexes could be built on the same fields so long as their filters are different.

      We should also add the unique and sparse parameters to the index signature. At present, it is not possible to build a sparse index on a particular key pattern if an existing non-sparse index is already present. Users who wish to move from a full index to a sparse index have little option but to drop the existing index before building the sparse version. A similar situation exists for users who wish to introduce a uniqueness constraint on a field which is already indexed. Workarounds do exist in these situations, but they are ugly and more labour-intensive than should be necessary.

            yoonsoo.kim@mongodb.com Yoon Soo Kim
            bernard.gorman@mongodb.com Bernard Gorman
            0 Vote for this issue
            11 Start watching this issue