Navigation

db.killOp()

Description

db.killOp(opid)

Terminates an operation as specified by the operation ID. To find operations and their corresponding IDs, see $currentOp or db.currentOp().

The db.killOp() method has the following parameter:

Parameter Type Description
op number An operation ID.

Warning

Terminate running operations with extreme caution. Only use db.killOp() to terminate operations initiated by clients and do not terminate internal database operations.

Changed in version 4.0: The db.killOp() method can be run on a mongos and can kill queries that are running on more than one shard in a cluster. For information on how to list sharding operations that are active on a mongos, see the localOps parameter in $currentOp.

Access Control

On systems running with authorization, to kill operations not owned by the user, the user must have access that includes the killop privilege action.

Changed in version 3.2.9: On mongod instances, users can kill their own operations even without the killop privilege action.