Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5440

Call out compound key case in sparse unique indexes

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: mongodb-2.6, mongodb-3.0
    • Fix Version/s: None
    • Component/s: manual, Server

      Description

      The docs state:

      sparse and unique Properties

      An index that is both sparse and unique prevents collection from having documents with duplicate values for a field but allows multiple documents that omit the key.

      The idea of the [entire] key being absent has some nuance that is not immediately apparent; in the case of a compound key, all elements of the key must be absent in order for this to apply.

      A suggested alternative would be:

      allows multiple documents that omit all fields in the key

        Attachments

          Activity

            People

            Assignee:
            kay.kim Kay Kim (Inactive)
            Reporter:
            steffan.mejia Steffan Mejia
            Participants:
            Last commenter:
            Kay Kim Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Days since reply:
              6 years, 20 weeks, 1 day ago