mongosh admin --eval 'db.shutdownServer()'

Category: Databases & SQL

mongosh admin --eval 'db.shutdownServer()'

Shut down the MongoDB server

Runs the shutdownServer command against the admin database; requires admin privileges and is normally executed on the server host itself. It stops mongod cleanly — not something to run casually on production. Related: mongostat to watch the server.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.