I’m working on optimization slow aggregation pipelines. I use explain() method to show more details about what MongoDB do with this query, but it doesn’t give as many information as MsSQL.
Is there any other tools besides explain()? Something that can tell me which part of execution of pipeline takes the most of time?
explain has different modes:
Each mode returns a query plan with different verbosity / details. You may want to try out and see which one suits your need. The default mode is “queryPlanner”.
The way to use is:
db.collection.explain("...").aggregate( [ ... ] )
Reference: Information on Aggregation Optimization