I have 2 dbs:
- admin
- ops
I have a user with a readWriteAnyDatabase
role but he cannot list the collections in the ops
db.
I have another user with a root
role and he succeeded in listing the collections for the ops
db.
I try to view the collections in ops
The error I am getting:
Not authorized to execute command: listCollections…
using mongodb: 3.4.7
In the mongoDB config I only added auto=true
.
What can be the cause?
Best Answer
You need to give that "readWriteAnyDatabase" role to the user for "admin" database.
after that you can login with that user and see all collections