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

dropDups ignored on index creation

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.0
    • Component/s: Index Maintenance
    • Labels:
      None
    • Major Change
    • ALL
    • Hide

      Create duplicate data:

          db.test.insert({ "a": 1 })
          db.test.insert({ "a": 1 })
      

      Try to create the index:

          db.test.ensureIndex({ "a": 1 },{ "unique": true, "dropDups": true })
      

      Index build fails with message:

          {
              "createdCollectionAutomatically" : false,
              "numIndexesBefore" : 1,
              "errmsg" : "exception: E11000 duplicate key error dup key: { : 1.0 }",
              "code" : 11000,
              "ok" : 0
          }
      
      Show
      Create duplicate data: db.test.insert({ "a" : 1 }) db.test.insert({ "a" : 1 }) Try to create the index: db.test.ensureIndex({ "a" : 1 },{ "unique" : true , "dropDups" : true }) Index build fails with message: { "createdCollectionAutomatically" : false , "numIndexesBefore" : 1, "errmsg" : "exception: E11000 duplicate key error dup key: { : 1.0 }" , "code" : 11000, "ok" : 0 }

      The dropDups option is being ignored and indexing fails when a key with a unique constraint contains duplicates

            Assignee:
            Unassigned Unassigned
            Reporter:
            neillunn Neil Lunn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: