How to stop MongoDB Server running on Ubuntu

Stop MongoDB Server Ubuntu

The most cleanest way to shutdown MongoDB is by executing the below commands,

> use admin
> db.shutdownServer();
Example:
> use admin
switched to db admin
> db.shutdownServer();
server should be down...

You can also stop MongoDB mongod service running on Ubuntu, run the command sudo service mongod stop

# sudo service mongod stop

or,

# sudo service mongodb stop

 * Stopping database mongodb   [OK]

You can also check the status of the server using the command,

# sudo service mongodb status

Comments & Discussion

Facing issues? Have questions? Post them here! We're happy to help!