-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.5.4
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
getLastError appears to always return true for updatedExisting when the last operation was an update, regardless of whether a document was updated or not.
> db.test.remove() SingleWriteResult({ "writeErrors" : [ ], "writeConcernErrors" : [ ], "nInserted" : 0, "nUpserted" : 0, "nUpdated" : 0, "nModified" : 0, "nRemoved" : 2, "upserted" : [ ] }) > db.test.insert({i: 1}) SingleWriteResult({ "writeErrors" : [ ], "writeConcernErrors" : [ ], "nInserted" : 1, "nUpserted" : 0, "nUpdated" : 0, "nModified" : 0, "nRemoved" : 0, "upserted" : [ ] }) > db.test.update({i: 5}, {$set: {i: 500}}) SingleWriteResult({ "writeErrors" : [ ], "writeConcernErrors" : [ ], "nInserted" : 0, "nUpserted" : 0, "nUpdated" : 0, "nModified" : 0, "nRemoved" : 0, "upserted" : [ ] }) > db.runCommand('getLastError') { "updatedExisting" : true, "n" : 0, "connectionId" : 2291, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1 } > db.test.find() { "_id" : ObjectId("52d07a4cd05c85fb8d3f5e3d"), "i" : 1 } > db.test.update({i: 5}, {$set: {i: 1}}) SingleWriteResult({ "writeErrors" : [ ], "writeConcernErrors" : [ ], "nInserted" : 0, "nUpserted" : 0, "nUpdated" : 0, "nModified" : 0, "nRemoved" : 0, "upserted" : [ ] }) > db.runCommand('getLastError') { "updatedExisting" : true, "n" : 0, "connectionId" : 2291, "syncMillis" : 0, "writtenTo" : null, "err" : null, "ok" : 1 } > db.test.find() { "_id" : ObjectId("52d07a4cd05c85fb8d3f5e3d"), "i" : 1 }
- related to
-
SERVER-12474 mongos gle no longer returns updatedExisting in 2.5.4 nightly
- Closed