OPTIONS

sleep

On this page

Definition

sleep

Forces the database to block all operations. This is an internal command for testing purposes.

The sleep command takes the following prototype form:

{ sleep: 1, w: <true|false>, secs: <seconds> }

The sleep command has the following fields:

Field Type Description
w boolean If true, obtains a global write lock. Otherwise obtains a read lock.
secs integer The number of seconds to sleep.

Behavior

The command places the mongod instance in a write lock state for 100 seconds. Without arguments, sleep causes a “read lock” for 100 seconds.

Warning

sleep claims the lock specified in the w argument and blocks all operations on the mongod instance for the specified amount of time.

Note

sleep is an internal command that is not enabled by default. sleep must be enabled by using --setParameter enableTestCommands=1 on the mongod command line. sleep cannot be enabled during run-time.