Docs Menu

Terminate a Running Data Lake Query

On this page

  • Syntax
  • Options
  • Output
  • Examples

You can terminate long-running queries using the killOp command. For more information, see killOp. In Atlas Data Lake:

  • The op parameter value is an ObjectId.
  • The comment parameter is not supported.

If you are an Admin user, you can kill any query on a Data Lake. The user who issued the query can also terminate the query. To run this command, use db.runCommand(). You must run killOp against the admin database.

db.runCommand({ "killOp": 1, "op": ObjectId(<hexadecimal>) })
Field
Type
Description
Necessity
op
Unique identifier, in ObjectId format, of the operation to terminate. You can use $currentOp to retrieve the opid of the operation to terminate.
Required

killOp returns the following if it succeeds in marking the specified operation for termination:

{ "info" : "attempting to kill op", "ok" : 1 }

Note that the output is the same whether or not the operation being terminated is currently running. You can use $currentOp to verify that the operation was terminated.

For the example below, suppose a query with opid value of ObjectId("1635fad364c529820c6f9e76") is running. The following command terminates this query.

use admin
db.runCommand({ "killOp": 1, "op": ObjectId("1635fad364c529820c6f9e76") })

The previous command returns the following:

{ "info" : "attempting to kill op", "ok" : 1 }
←  Determine Status of Data Lake QueriesRetrieve Data Lake Query History →
Give Feedback
© 2022 MongoDB, Inc.

About

  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.