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

"too many users are authenticated" after getSiblingDB() and auth()

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 4.0.1, 4.0.2
    • Component/s: None
    • None
    • ALL
    • Hide

      This is how I fare with MongoDB 4.0:

       ~$ mongo mongodb://daniel:mahpass@127.0.0.1:27017/admin
      {{ mongo $MONGO_URI/admin}}
      {{ MongoDB shell version v4.0.2}}
      {{ connecting to: mongodb://127.0.0.1:27017/admin}}
      {{ MongoDB server version: 4.0.2}}
      {{ > var mother = db.getSiblingDB('mother')}}
      {{ > mother.auth(}}{{

      { user: 'daniel', pwd: 'mahpass' }

      }})
      {{ 1}}
      {{ > mother.sites.find()}}
      {{ Error: error: {}}
      {{ "ok" : 0,}}
      {{ "errmsg" : "too many users are authenticated",}}
      {{ "code" : 13,}}
      {{ "codeName" : "Unauthorized"}}
      {{ }}}
      {{ >}}

      Show
      This is how I fare with MongoDB 4.0:  ~$ mongo mongodb://daniel:mahpass@127.0.0.1:27017/admin {{ mongo $MONGO_URI/admin}} {{ MongoDB shell version v4.0.2}} {{ connecting to: mongodb://127.0.0.1:27017/admin}} {{ MongoDB server version: 4.0.2}} {{ > var mother = db.getSiblingDB('mother')}} {{ > mother.auth(}}{{ { user: 'daniel', pwd: 'mahpass' } }} ) {{ 1}} {{ > mother.sites.find()}} {{ Error: error: {}} {{ "ok" : 0,}} {{ "errmsg" : "too many users are authenticated",}} {{ "code" : 13,}} {{ "codeName" : "Unauthorized"}} {{ }}} {{ >}}

      With MongoDB versions 4 (4.0.1 and 4.0.2 tested), I cannot switch to another db, authenticate, and operate with that db. In MongoDB 3.6, I can successfully do this:

      ~$ mongo mongodb://daniel:mahpass@127.0.0.1:27017/admin
      {{ MongoDB shell version v3.6.7}}
      {{ connecting to: mongodb://127.0.0.1:27017/admin}}
      {{ MongoDB server version: 3.6.7}}
      {{ > var mother = db.getSiblingDB('mother')}}
      {{ > mother.auth(}}{{

      { user: 'daniel', pwd: 'mahpass' }

      }})
      {{ 1}}
      {{ > mother.sites.find()}}{{

      { "_id" : ObjectId("54b1d0a26629edca9cbef6c3"), "client" : "Dev", "dbName" : "mother", "domain" : "mother.localhost", "licenses" : 0, "name" : "Mother" }

      }}

      >

      My user was created on the admin database first, with "dbOwner" and "userAdminAnyDatabase" rights, and then on the "mother" database with "dbOwner" rights.

      In other words, these are two different users, one on each db.

      Googling the error, I only get four hits, one in Chinese, and the remaining I cannot see how are related. I've searched through the 4.0 changes, and cannot find any documented change that would cause this restriction — if indeed it is a restriction? Maybe this isn't a bug, and it's just me misbehaving?

      Thanks

      Daniel

            Assignee:
            nick.brewer Nick Brewer
            Reporter:
            Daniel Smedegaard Buus Daniel Smedegaard Buus [X]
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: