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

Create User commands are not added to mongo shell history

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Shell
    • None
    • ALL

      I just compiled 4.2 server and when I run commands against it from the 4.2 shell, which fail, the failing commands are not added to the history buffer.

      Session log:

      speed% /usr/local/m/versions/4.2/mongo  --ssl --sslCAFile  /home/w/apps/ruby-driver/spec/support/certificates/ca.crt --sslPEMKeyFile /home/w/apps/ruby-driver/spec/support/certificates/client-x509.pem 
      2019-10-14T23:28:29.195-0400 W  CONTROL  [main] Option: ssl is deprecated. Please use tls instead.
      2019-10-14T23:28:29.195-0400 W  CONTROL  [main] Option: sslPEMKeyFile is deprecated. Please use tlsCertificateKeyFile instead.
      2019-10-14T23:28:29.195-0400 W  CONTROL  [main] Option: sslCAFile is deprecated. Please use tlsCAFile instead.
      MongoDB shell version v4.2.1-rc0-7-g3135b6a
      connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
      Implicit session: session { "id" : UUID("f1eb660c-31ea-440a-a74d-b8070d34655e") }
      MongoDB server version: 4.2.1-rc0-7-g3135b6a
      MongoDB Enterprise > db.serverStatus()
      {
      	"ok" : 0,
      	"errmsg" : "not authorized on admin to execute command { serverStatus: 1.0, lsid: { id: UUID(\"f1eb660c-31ea-440a-a74d-b8070d34655e\") }, $db: \"admin\" }",
      	"code" : 13,
      	"codeName" : "Unauthorized"
      }
      MongoDB Enterprise > db.createUser()
      2019-10-14T23:28:43.907-0400 E  QUERY    [js] uncaught exception: TypeError: userObj is undefined :
      DB.prototype.createUser@src/mongo/shell/db.js:1336:9
      @(shell):1:1
      MongoDB Enterprise > db.createUser()
      2019-10-14T23:28:58.226-0400 E  QUERY    [js] uncaught exception: TypeError: userObj is undefined :
      DB.prototype.createUser@src/mongo/shell/db.js:1336:9
      @(shell):1:1
      MongoDB Enterprise > db.createUser({})
      2019-10-14T23:29:04.637-0400 E  QUERY    [js] uncaught exception: Error: no 'user' field provided to 'createUser' function :
      DB.prototype.createUser@src/mongo/shell/db.js:1338:15
      @(shell):1:1
      MongoDB Enterprise > db.createUser({user:'foo'})
      2019-10-14T23:29:10.962-0400 E  QUERY    [js] uncaught exception: Error: couldn't add user: not authorized on test to execute command { createUser: "foo", writeConcern: { w: "majority", wtimeout: 600000.0 }, lsid: { id: UUID("f1eb660c-31ea-440a-a74d-b8070d34655e") }, $db: "test" } :
      _getErrorWithCode@src/mongo/shell/utils.js:25:13
      DB.prototype.createUser@src/mongo/shell/db.js:1370:11
      @(shell):1:1
      MongoDB Enterprise > db.serverStatus()
      

      Despite me issuing a number of commands, the next available command in the history is serverStatus.

            Assignee:
            Unassigned Unassigned
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: