I can\'t believe I have to ask this, but how do I stop a query I just ran, which is now running, and will obviously take a very long time to complete in the Mongo shell? C
According to Mongo documentation, you should:
db.currentOp()
db.killOp()
Good example script can be found here.
Based on Alex's answer.
Query current running operations:
db.currentOp()
Kill the operation based on opid
db.killOp(30318806)
For sharded cluster:
db.currentOp()
db.killOp("shard_id:opid")
For example:
db.killOp("shard0000:3134616")