0

I am following the directions here to try and install Mongo 3.6 w/ authentication turned on. I have added a "root" user and I am able to login using Mongo shell and I added a application user as well, but when I try to list DBs or collections using either root or the other userid I created I get the following error:

not authorized on on admin to execute command { listDatabase: 1.0, $db: \"admin\" }

I also get this when I try to login through my node app using the application user. What am I doing wrong?

1 Answer 1

0

Ok, so the problem was two-fold:

  1. I had added the app user to the wrong database. It seems like all users should be added to admin, not the database you want to grant permissions on
  2. I was missing some roles on my "root" user. The one that seemed to fix it was the "root" role
  3. I was missing the role needed to list databases on my app user. I added clisterMonitor and that seemed to work.

Those 3 together seemed to allow me to show dbs, show collections, and call listDatabases from MongoClient.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .