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

Call out compound key case in sparse unique indexes

    XMLWordPrintable

Details

    • Task
    • Status: Open
    • Minor - P4
    • Resolution: Unresolved
    • mongodb-2.6, mongodb-3.0
    • None
    • 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

            kay.kim@mongodb.com Kay Kim (Inactive)
            steffan.mejia@mongodb.com Steffan Mejia
            Kay Kim Kay Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              7 years, 3 weeks, 1 day ago