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

verboseShell error messaging is redundant in non-legacy writes modes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor - P4
    • Resolution: Unresolved
    • Affects Version/s: 2.6.0-rc2
    • Fix Version/s: Backlog
    • Component/s: Shell
    • Labels:
    • Operating System:
      ALL
    • Steps To Reproduce:
      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'});

      Description

      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

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: