Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1761

mongosh unable to run command on arbiter

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: 2.2.0
    • Component/s: None
    • None
    • Environment:
      OS: redhat 8.8
      node.js / npm versions:
      Additional info:
    • Developer Tools
    • Not Needed

      Problem Statement/Rationale

      From mongo version 6 onwards, I am not able to run any command using mongosh to login. 

      bin/mongosh -u xxx -p xxxx --port 1234 admin
      
      Using MongoDB:          7.0.6
      Using Mongosh:          2.2.0
       
      For mongosh info see: https://docs.mongodb.com/mongodb-shell/
       
      Warning: Found ~/.mongorc.js, but not ~/.mongoshrc.js. ~/.mongorc.js will not be loaded.
        You may want to copy or rename ~/.mongorc.js to ~/.mongoshrc.js.
      xxxxxxxxxxx [direct: arbiter] admin> rs.conf();
      MongoServerError[Unauthorized]: Command replSetGetConfig requires authentication 

       

      But, if I were to use the old mongoDB shell, I can run those commands.

      MongoDB shell version v5.0.25 
      MongoDB server version: 7.0.6
      WARNING: shell and server versions do not match
      ================
      Warning: the "mongo" shell has been superseded by "mongosh",
      which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
      an upcoming release.
      For installation instructions, see
      https://docs.mongodb.com/mongodb-shell/install/ 
      xxxxxxxxxxx :ARBITER> rs.conf();
      {        
      "_id" : "xxxxxxxxxxx",        
      "version" : 3,        
      "term" : 1,        
      "members" : [...]
      ...
      }

       

      I would like to know if this is expected behavior for mongosh and it is not due to any issue due to configuration etc. Thanks! 

            Assignee:
            Unassigned Unassigned
            Reporter:
            weiqi.tan@mlp.com Wei Qi Tan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: