Removing database from replica set

I am trying tying to remove database from replica set. In that process, I tried to drop the local database
or remove the system.replset. I am not able to do it as I am getting not authorized error. I have connected to the database using m103-admin which is the root user. I tried multiple blogs everyone is pointing towards authorization setting, however m103-admin is the root user so kindly help me to understand if I am missing something.
MongoDB Enterprise > db.system.replset.remove({"_id" : “m103-example”})
“writeError” : {
“code” : 13,
“errmsg” : “not authorized on local to execute command { delete: “system.replset”, ordered: true, lsid: { id: UUID(“58ff1e66-84a5-4a21-ad34-2f2949882dd4”) }, $db: “local” }”
MongoDB Enterprise > use local
switched to db local
MongoDB Enterprise > db.dropDatabase()
“ok” : 0,
“errmsg” : “not authorized on local to execute command { dropDatabase: 1.0, lsid: { id: UUID(“58ff1e66-84a5-4a21-ad34-2f2949882dd4”) }, $db: “local” }”,
“code” : 13,
“codeName” : “Unauthorized”

You have to give R/W permissions on local DB to admin user

Please check this link

Cleanup node state to add to replica set

Also check this link

1 Like