How to connect to mongosh with a user with clusterManager role


I need to run one of admin roles and in order to be able to do that, the user I use for running the command needs to have clusterManager role. When connecting to mongosh, I need to provide credentials of a database user, however I cannot create a database user with clusterManager role. So how can I execute a command from mongosh, which requires clusterManager role, if a user I use for connecting to the cluster cannot have this role ? Maybe there’s another way to do that ?

Hi, Maciej_Pakulski1

If I am understanding this correctly, the only way to solve your problem is to create a user that has the clusterManager role, or if you have a user with ‘root’ then you would be able to execute the commands.

If the user doesn’t have the role then there is no way to access the specific commands for that role. If you could it would make the idea of roles useless because anyone could use any command.

1 Like