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

Make duplicate key error message more meaningful with arbitrary cluster keys

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Execution

      Currently the RecordStore's duplicate key error message assumes the primary key is always _id. For example, on a collection clustered by ts:

      > db.c.count()
      0
      > db.c.insertOne({_id:0, ts:1})
      { "acknowledged" : true, "insertedId" : 0 }
      > db.c.insertOne({_id:1, ts:1})
      WriteError({
      	"index" : 0,
      	"code" : 11000,
      	"errmsg" : "E11000 duplicate key error collection: local.c dup key: { _id: 1 }",
      	"op" : {
      		"_id" : 1,
      		"ts" : 1
      	}
      }) :
      

      The output is misleading: the duplicate key is actually ts, not the reported _id.

      Extend it to make the error message meaningful with arbitrary cluster keys.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            josef.ahmad@mongodb.com Josef Ahmad
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: