Created
July 9, 2015 13:31
-
-
Save BibMartin/f1833f134024ed276f4b to your computer and use it in GitHub Desktop.
Watch and kill queries with pymongo
This file contains hidden or 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
| import pymongo | |
| connection = pymongo.MongoClient() | |
| # get running operations | |
| list(connection.admin["$cmd.sys.inprog"].find()) | |
| # kill an operation by id | |
| op_id = 123456 | |
| connection.admin["$cmd.sys.killop"].find_one({'op':op_id}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment