MongoDB permission to view collections not working
You need to give that "readWriteAnyDatabase" role to the user for "admin" database.

use admin
db.createUser({user:"test", pwd:"test", roles: ["readWriteAnyDatabase"]})


after that you can login with that user and see all collections

mongo -u test -p test --authenticationDatabase admin opt
Mongo&gt; db
opt
Mongo&gt; show collections
test_collection
Mongo&gt;