db.shutdownServer() in mongoDB

shutdownServer()

This method shuts down the current mongod or mongos process cleanly and safely.


Syntax:

db.shutdownServer() 


Example 1: When the database is not an admin database.

use products

MongoDB

db.shutdownServer()

Output

shutdown command only works with the admin database; try 'use admin'

Example 2: When the database is an admin database.

use admin

MongoDB

db.shutdownServer()

Output

server should be down...


No comments:

Post a Comment