- Reference >
- Database Commands >
- Administration Commands >
- killOp
killOp¶
On this page
New in version 3.2.
Definition¶
-
killOp
¶ Terminates an operation as specified by the operation ID. The
mongo
shell provides thedb.killOp()
helper. To find operations and their corresponding IDs, seedb.currentOp()
.The
killOp
command must be run against theadmin
database.To run killOp, use the
db.runCommand( { <command> } )
method.The command has the following form:
{ "killOp": 1, "op": <opid> }
Parameter Type Description op
number An operation ID. Warning
Terminate running operations with extreme caution. Only use
killOp
to terminate operations initiated by clients and do not terminate internal database operations.
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.
Example¶
The following example uses killOp
to target
the running operation with opid 3478
.
db.adminCommand( { "killOp": 1, "op": 3478 } )
The operation returns the following result:
{ "info" : "attempting to kill op", "ok" : 1 }
killOp
only confirms its attempt to end the
specified operation. Use db.currentOp()
to confirm the
target operation was terminated.