Using setVerboseShell(true) with 'compatibility' or 'commands' writes leads to duplicate error messages in the shell. This bug seems like it will affect any caller of DBCollection.prototype._printExtraInfo.
Write Commands:
> setVerboseShell(true); > db.test1.drop(); true > > db.test1.insert({_id: 'a'}); Inserted 1 record(s) in 6ms WriteResult({ "nInserted" : 1 }) > db.test1.insert({_id: 'a'}); insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.test1.$_id_ dup key: { : "a" } WriteResult({ "nInserted" : 0, "writeError" : { "code" : 11000, "errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.test1.$_id_ dup key: { : \"a\" }" } })
Compatibility mode:
> setVerboseShell(true); > db.getMongo().forceWriteMode('compatibility'); > db.test1.drop(); false > > db.test1.insert({_id: 'a'}); Inserted 1 record(s) in 416ms WriteResult({ "nInserted" : 1 }) > db.test1.insert({_id: 'a'}); insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.test1.$_id_ dup key: { : "a" } WriteResult({ "nInserted" : 0, "writeError" : { "code" : 11000, "errmsg" : "insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.test1.$_id_ dup key: { : \"a\" }" } })
Legacy mode:
> setVerboseShell(true); > db.getMongo().forceWriteMode('legacy'); > db.test1.drop(); true > > db.test1.insert({_id: 'a'}); Inserted 1 record(s) in 2ms > db.test1.insert({_id: 'a'}); insertDocument :: caused by :: 11000 E11000 duplicate key error index: test.test1.$_id_ dup key: { : "a" }
Version: a12d09c9757301c3872cf4b45027d287e3dcc366