First of all Thanks for your guidance and responses.
Actually, I have followed the Link to create “shard-local administrator” on Mongod instance using below query.
admin = db.getSiblingDB("admin")
admin.createUser(
{
user: "fred",
pwd: "changeme1",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
After that wrongly update the role on this same user using below query
db.updateUser(
... {
... user: "fred",
... pwd: "changeme1",
... roles: [ { role: "dbAdmin", db: "mydb" } ]
... }
... )
After that getting error while running db.getUsers()
“Error: not authorized on admin to execute command”
I am not able to drop the user as well.
Please Guide me to fix the issue.