Computer >> Computer tutorials >  >> Programming >> MongoDB

MongoDB shutdown option is unavailable? How to get it?


You need to switch the database to admin. Following is the syntax −

use admin

The syntax is as follows for shutdown option −

db.shutdownServer()

Let us implement the above syntax for shutdown −

> use admin
switched to db admin
> db.shutdownServer()

This will produce the following output −

server should be down...
2019-04-22T19:11:40.949+0530 I NETWORK [js] trying reconnect to 127.0.0.1:27017 failed
2019-04-22T19:11:42.197+0530 I NETWORK [js] reconnect 127.0.0.1:27017 failed failed