MongoDB Troubleshooting Queries: Saving Time on Performance Investigations
May 2, 2026
Recently, my team and I investigated a MongoDB performance issue. High CPU usage turned out to be a query problem. Nothing new, but while digging through the database, I realized we kept running the same diagnostic queries over and over.
One query that really helped was checking for long-running operations:
db.currentOp({
secs_running: { $gte: 30 }
})
It immediately showed us which queries were taking too long. After we fixed the issues, I thought: why not save these queries somewhere? Next time this happens (and it will), we won't waste time remembering what to run.
So I created a list of useful MongoDB troubleshooting queries. If you ever find yourself debugging MongoDB performance, it might save you some time: MongoDB Troubleshooting Queries.
See you next time!