3

I created an account on mongolab, then created database and user. If I start mogno shell and connect to my database like this

mongo ***.mlab.com:***/projectname?authMode=scram-sha1 -u myname -p mypass

And then type show dbs I get this error

2017-02-27T20:06:10.834+0200 E QUERY    [thread1] Error: listDatabases failed:{
        "ok" : 0,
        "errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
        "code" : 13
} :

It says that I am not authorized but when I look at User Configuration in the mongolab website it says this user has dbOwner role. How do I get authorized at the database so I can read/write data?

Community
  • 1
  • 1
Arthur Kishinets
  • 147
  • 4
  • 15

1 Answers1

1

That is because of how monogolab sets up the server. Look at their FAQ.

http://docs.mlab.com/faq/#i-am-new-to-mongodb---where-do-i-start

In addition, there are certain commands (e.g., “show dbs”), that will not work unless you have a Dedicated plan with full database administrative privileges.

So you can't run that command because your user does not have privileges to do that. You only have the dbOwner role on your database not on the admin database.

Leo
  • 834
  • 8
  • 14