MongoDB: db.shutdownServer() method
db.shutdownServer
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.
Syntax:
db.shutdownServer()
Example: MongoDB: db.shutdownServer() method
use admin
db.shutdownServer()
Output:
> 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 127.0.0.1:27017 (127.0.0.1) failed 2016-01-14T18:08:20.666+0530 warning: Failed to connect to 127.0.0.1:27017, reason: errno:10061 No connection could be made because the target machine actively refused it. 2016-01-14T18:08:20.666+0530 reconnect 127.0.0.1:27017 (127.0.0.1) failed failed couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
Retrieve the restaurants data from here
Previous:
db.setProfilingLevel() method
Next:
db.stats() method
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/mongodb/shell-methods/database/db-shutdownServer.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics