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

Return dupKey as field in getLastError on dup (not in string only)

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Internal Code, Usability

      Add the key/index fields as shown below.

      E11000 duplicate key error index: test.people.$_id_  dup key: { : ObjectId('4e683574bc4135eee514713f') }
      > db.getLastErrorObj()
      {
              "err" : "E11000 duplicate key error index: test.people.$_id_  dup key: { : ObjectId('4e683574bc4135eee514713f') }",
              "code" : 11000,
              "key": { "_id" : ObjectId('4e683574bc4135eee514713f') }
              "index" : "test.people.$_id_",
              "n" : 0,
              "connectionId" : 1777,
              "ok" : 1
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            scotthernandez Scott Hernandez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: