Shutdownserver not working

Hi, I am trying to run

mongo admin --eval 'db.shutdownServer()'

but I get the error
0 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:6

any ideas on what I am doing wrong?

It seems like you are running the mongo command while you are in mongo shell.

You need to quit() the shell before running mongo admin --eval 'db.shutdownServer()'

Kanika

1 Like