Created
August 21, 2017 14:18
-
-
Save khapota/a4bef5f2c40d75356c1ccac7a8d6f280 to your computer and use it in GitHub Desktop.
Kill long query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.currentOp().inprog.forEach( | |
function(op) { | |
if(op.secs_running > 5 && op.op == 'query') printjson(op); | |
} | |
) |
// check theo collection op.ns
if(op.secs_running > 10 && op.ns.indexOf('collection_name') !== -1) printjson(op);
Check op structure in document because it is changed following version of mongodb.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
db.currentOp().inprog.forEach(
function(op) {
if(op.secs_running > 5 && op.op == 'query') db.killOp(op.opid);
}
)