MongoDB Tip: MongoDB Compass and kill long running transaction
We can use MongoDB Compass to monitor database performance live, which is useful sometimes when we encounter some issues on the database where some queries are taking longer than normal. In this case, we can kill these queries by first identifying the opid of the long running query using mongodb compass. This is the view of the MongoDB Compass tab, click into the command on the top of the list of slowest operations Now copy the opid and use any client tool of your choosing, make sure you are connected to the primary node by first identify yourself with rs.isMaster() ismaster should contain the value "true" then db.killOp(<opid>) Sometimes the transaction may take a few second to kill, and you click into the slowest operation, you can see the pendingKill for this opid is set to true.