Duplicate key error message does not contain index name anymore

XMLWordPrintableJSON

    • 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\" }" } })
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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 Horowitz (Inactive)
            Reporter:
            Rainer Frey
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: