This is what I have tried, but does not seem to work, kills only 1 operation.
function s() {
t = db.currentOp()['inprog'];
k= new Array();
for(i=0;i< t.length;i++)
{
if(t[i]["ns"].indexOf("my_namespace") != -1) //fetch all required current Operations
k.push(t[i]);
}
for(j=0;j<k.length;k++)
{
db.killOp(k[j]['opid']); // kill them by opid , works only once
}
Since you’re using v1.6, then the following JIRA is probably related to your problem, and was resolved in 1.7.2: https://jira.mongodb.org/browse/SERVER-1816
So if this is the issue, try upgrading to 1.8. Or you could try the following: