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

verboseShell error messaging is redundant in non-legacy writes modes

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.6.0-rc2
    • Component/s: Shell
    • Labels:
    • ALL
    • Hide
      setVerboseShell(true);
      db.test1.drop();
      
      db.test1.insert({_id: 'a'});
      db.test1.insert({_id: 'a'});
      
      Show
      setVerboseShell(true); db.test1.drop(); db.test1.insert({_id: 'a'}); db.test1.insert({_id: 'a'});

      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

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            kamran.khan Kamran K.
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: