MongoDB: db.shutdownServer() method


The db.shutdownServer() method is used to shut down the current mongod or mongos process cleanly and safely. This operation fails when the current database is not the admin database.



Example: MongoDB: db.shutdownServer() method

use admin


> use admin
switched to db admin
> db.shutdownServer()
2016-01-14T18:08:19.627+0530 DBClientCursor::init call() failed
server should be down...
2016-01-14T18:08:19.647+0530 trying reconnect to ( failed
2016-01-14T18:08:20.666+0530 warning: Failed to connect to, reason: errno:10061 No connection could be made because the target machine actively refused it.
2016-01-14T18:08:20.666+0530 reconnect ( failed failed couldn't connect to server (, connection attempt failed

Retrieve the restaurants data from here

Previous: db.setProfilingLevel() method
Next: db.stats() method

Follow us on Facebook and Twitter for latest update.

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook