This version of the documentation is archived and no longer supported.



The shutdown command cleans up all database resources and then terminates the process. You must issue the shutdown command against the admin database:

The command has the following syntax:

  shutdown: 1,
  force: <boolean>
  timeoutSecs: <int>

The command takes the following optional field:

Field Description

Specify 1.


Optional. Specify true to force the mongod to shut down. Force shutdown interrupts any ongoing operations on the mongod and may result in unexpected behavior.


Optional. The number of seconds the primary should wait for a secondary to catch up. Defaults to 10.

If no secondaries catch up within the specified time, the command fails.


For a mongod started with Authentication, you must run shutdown over an authenticated connection. See Access Control for more information.

For a mongod started without Authentication, you must run shutdown from a client connected to the localhost interface. For example, run a mongo with the --host "" option on the same host machine as the mongod.

shutdown on Replica Set Members

shutdown fails if the replica set member is running certain operations. You can specify force: true to force the member to interrupt those operations and shut down.

Shutting Down the Replica Set Primary

If running shutdown against the replica set primary, the operation implicitly uses replSetStepDown to step down the primary before shutting down the mongod. If no secondary in the replica set can catch up to the primary within 10 seconds, the shutdown operation fails. You can issue shutdown with force: true to shut down the primary even if the step down fails.


Force shutdown of the primary can result in the rollback of any writes not yet replicated to a secondary.

Access Control

To run shutdown on a mongod enforcing Authentication, the authenticated user must have the shutdown privilege. For example, a user with the built-in role hostManager has the appropriate permissions.


Shut down a mongod

db.adminCommand({ "shutdown" : 1 })

Force Shut Down a mongod

db.adminCommand({ "shutdown" : 1, "force" : true })

Shut Down a Primary mongod With Longer Timeout

db.adminCommand({ "shutdown" : 1, timeoutSecs: 60 })