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

Duplicate key error message does not contain index name anymore

    • Fully Compatible
    • ALL
    • Hide

      In mongo shell:

      db.test.insert({_id: "test"})
      db.test.insert({_id: "test"})
      

      Result with WiredTiger:

      WriteResult({
      	"nInserted" : 0,
      	"writeError" : {
      		"code" : 11000,
      		"errmsg" : "E11000 duplicate key error dup key: { : \"test\" }"
      	}
      })
      

      Result with MMAPv1:

      WriteResult({
      	"nInserted" : 0,
      	"writeError" : {
      		"code" : 11000,
      		"errmsg" : "E11000 duplicate key error index: rfy.test.$_id_ dup key: { : \"test\" }"
      	}
      })
      
      Show
      In mongo shell: db.test.insert({_id: "test" }) db.test.insert({_id: "test" }) Result with WiredTiger: WriteResult({ "nInserted" : 0, "writeError" : { "code" : 11000, "errmsg" : "E11000 duplicate key error dup key: { : \"test\" }" } }) Result with MMAPv1: WriteResult({ "nInserted" : 0, "writeError" : { "code" : 11000, "errmsg" : "E11000 duplicate key error index: rfy.test.$_id_ dup key: { : \"test\" }" } })

      With WiredTiger, the error returned by a duplicate key does not contain the name of the violated unique index. It is therefore not possible to identify which field in the inserted document causes the violation.

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            rainer.frey@inxmail.de Rainer Frey
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: