I wanted to create a user,and got authorize error.
So I modify the /etc/mongod.conf :


And then restart the mongo,and create the user on terminal :

use admin
    user: "superAdmin",
    pwd: "    ",
    roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]

It was success,then I modify /etc/mongod.conf back to :


And I use remote login with robomongo
And I want to check db.serverStatus().connections
But nothing happened?
How can I fix this? enter image description here


The userAdminAnyDatabase role does not grant access to run the serverStatus command. Your db.serverStatus() command is returning an authorization error and you are then referencing a non-existent connections property which results in the "no results to show" message.

You can confirm this by running db.serverStatus(), which should return something similar to the following if the current user is not authorized:

     "ok" : 0,
     "errmsg" : "not authorized on admin to execute command { serverStatus: 1.0 }",
     "code" : 13

To allow the serverStatus command you need to grant either a built-in role that includes this privilege (clusterMonitor or hostManager in MongoDB 2.6) or create a user-defined role if you want a more narrow scope.

For example, to create and grant a custom role to run serverStatus:

use admin
    role: "serverStatus",
    privileges: [
        { resource: { cluster: true }, actions: [ "serverStatus" ] },
    roles: []

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.