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

GetLastError After Upsert Should Include New _id

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.4
    • Affects Version/s: 1.5.3
    • Component/s: None
    • None

      The lastErrorObject should contain the newly inserted _id value from the upsert.

      > db.test.update(

      {foo:1}

      , {$set:{blah:1}}, 1, 1)
      > db.getLastErrorObj()

      { "err" : null, "updatedExisting" : false, "n" : 1, "ok" : true }

      > db.test.find()

      { "_id" : ObjectId("4c0155b806510000000000e7"), "blah" : 1, "foo" : 1 }

      I would expect the lastErrorObject to look something like this:

      { "err" : null, "updatedExisting" : false, "n" : 1, "ok" : true, inserted_id: ObjectId("4c0155b806510000000000e7")}

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            scotthernandez Scott Hernandez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: