Cannot shutdown server

What am I doing wrong?
MongoDB Enterprise > show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
MongoDB Enterprise > use admin
switched to db admin
MongoDB Enterprise > db.shutdownserver()
2019-04-14T22:01:03.154+0000 E QUERY [thread1] TypeError: db.shutdownserver is not a function :
MongoDB Enterprise >

I open up a new shell window, navigate to the correct directory, run vagrant ssh, then mongo

I also tried this:
MongoDB Enterprise > quit()
vagrant@m103:~ mongo admin --eval 'db.shutdownServer()' MongoDB shell version v3.6.12 connecting to: mongodb:// Implicit session: session { "id" : UUID("b15b68d9-bf5e-4007-8cc8-acd8353be967") } MongoDB server version: 3.6.12 server should be down... 2019-04-14T22:10:05.677+0000 I NETWORK [thread1] trying reconnect to ( failed 2019-04-14T22:10:05.677+0000 W NETWORK [thread1] Failed to connect to, in(checking socket for error after poll), reason: Connection refused 2019-04-14T22:10:05.677+0000 I NETWORK [thread1] reconnect ( failed failed 2019-04-14T22:10:05.677+0000 I QUERY [thread1] Failed to end session { id: UUID("b15b68d9-bf5e-4007-8cc8-acd8353be967") } due to SocketException: socket exception [CONNECT_ERROR] for couldn't connect to server, connection attempt failed vagrant@m103:~ vagrant status
The program ‘vagrant’ is currently not installed. To run ‘vagrant’ please ask your administrator to install the package ‘vagrant’

At one place you type shutdownserver all lower case and at the other you type it correctly with shutdownServer.

When you type mongo admin with –eval, it propably terminated mongod as it tries to reconnect and fails.

When you type vagrant status, you must not be on the vagrant machine. The prompt vagrant@m103: indicates that you are on the vagrant machine.

1 Like