Skip to content

Instantly share code, notes, and snippets.

@chiihuang
Created June 13, 2016 14:47
Show Gist options
  • Save chiihuang/9d4833b957245e6b26a88eb0ea427342 to your computer and use it in GitHub Desktop.
Save chiihuang/9d4833b957245e6b26a88eb0ea427342 to your computer and use it in GitHub Desktop.
Kill Multiple Op in MongoDB 3.2 when opid sometimes negative
// Change mydb.mycollection to your target ns
var result = db.currentOp();
result.inprog.filter(function(p){return p.ns === 'mydb.mycollection';}).map(function(p){return p.opid >= 0 ? p.opid : Math.pow(2,32) + p.opid;}).forEach(function(pid){ db.killOp(pid);});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment