0

I'm trying to shutdown mongodb so that I can convert it to a replica set, but I keep getting an error.

when using db.shutdownServer(), I get

 "errmsg" : "not authorized on admin to execute command 

I tried "use admin" and then running the command, but issue still persists. I saw another post where they said to use db.auth(username, password) but if I type that in cmd after connecting to cluster When I try db.auth(username, password) replacing username and password with actual values I get

SyntaxError: missing ) after argument list

I'm still new to mongodb so any help is appreciated.

1 Answer 1

1

can you share the piece of code.

you can rewrite the above command with

passwordPrompt() option

db.auth( "username", passwordPrompt() )

or

mongo --username "" --password -- --authenticationMechanism SCRAM-SHA-256

Sign up to request clarification or add additional context in comments.

5 Comments

I tried what you asked and it returned a 1, but db.shutdownServer() still doesn't work. Here's a screenshot postimg.cc/PpyqRZpf
@user6680 it's already replicaset on the screenshot. Also it's Atlas-hosted db - use Atlas UI/API to manage your cluster. Also shared tiers are shared between multiple users and have limited functionality in terms of admin commands.You cannot shut down a server that is being used by other people
Ok understood. I don't know what's telling you it's a replicaset from the screenshot though. My end goal is to get mongodb change streams working and it requires a replica set to be configured
@user6680 it is already configured. Run rs.status() to see members.
check the roles for your user "bob" or use admin and execute db.shutdownServer()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.