show dbs in MongoDB doesn't work
$ mongo
MongoDB shell version: 3.0.9
connecting to: test
> show dbs
2016-03-08T14:45:58.188+0530 E QUERY Error: listDatabases failed:{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
"code" : 13
}
at Error (<anonymous>)
at Mongo.getDBs (src/mongo/shell/mongo.js:47:15)
at shellHelper.show (src/mongo/shell/utils.js:630:33)
at shellHelper (src/mongo/shell/utils.js:524:36)
at (shellhelp2):1:1 at src/mongo/shell/mongo.js:47
>
This doesn't work either:
> db.createUser({user: "admin", pwd: "password", roles: [{role: "root", db: "admin"}]})
2016-03-08T14:48:34.595+0530 E QUERY Error: couldn't add user: not authorized on test to execute command { createUser: "admin", pwd: "xxx", roles: [ { role: "root", db: "admin" } ], digestPassword: false, writeConcern: { w: "majority", wtimeout: 30000.0 } }
at Error (<anonymous>)
at DB.createUser (src/mongo/shell/db.js:1101:11)
at (shell):1:4 at src/mongo/shell/db.js:1101
>
Ref: http://stackoverflow.com/questions/23...
How do I fix this?
add a comment