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

ensureIndex() fails to create unique index if non-unique index already exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 1.8.0-rc1
    • None
    • Index Maintenance
    • None
    • Windows 7, single instance, no shards
    • ALL

    Description

      db.foo.ensureIndex(

      {a : 1}

      );
      db.foo.save(

      {key:1, a:1}

      );
      db.foo.save(

      {key:2, a:2}

      );

      db.foo.ensureIndex(

      {a : 1}

      ,

      {name:'uniquea', unique:true}

      );

      db.foo.getIndexes() shows that 'uniquea' has not been created. While we should be checking to avoid creating exact duplicate indexes, my attempt to create a new unique index should succeed, because there isn't already a unique one. I might be doing this in preparation for replacing the (non-unique) 'a_1' index with 'uniquea'.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dan@mongodb.com Daniel Pasette (Inactive)
              Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: