I am guessing your config file enables authentication, but you forgot to add, at least, an admin user. when auth is enabled you can only access from localhost (inside the container) until you create the first user.
Hi @Dev_Engine,
As mentioned by the error, you are not authorized to do this operation!
So you need to authenticate before with a user which have the correct privileges. For example:
alright then, second round: after the first user is created, you cannot just do whatever you want without proper credentials and assigned roles
now, to understand how you ended up with this error, please share how you enabled auth, how you added users, which user is logged in to which database, and how you logged in.
either give detailed lines of commands you have used (minus sensitive information such as password),
or create a new container to reproduce the error with 1 or 2 users and minimal setup, then share those steps.
Mongodb is running in a k8 container. So I figured that there is no way to do it within the container itself. I had to recreate the container or go to etcd to get the settings.
the equivalent command for k8 is “kubectl exec”. but the important part is that many things are still in your configuration files (pod,deployment,service etc). so also check them. keep in mind, if you are doing too many things inside the container/pod manually, then you are not following the repetable installation logic.
by the way, did that recration solve your problem?