Docs Menu
Docs Home
MongoDB Compass

Set Max Time MS for Aggregation Queries

On this page

  • About this Task
  • Steps
  • Learn More

Use the Max Time MS option on the Aggregations tab to specify an upper time limit in milliseconds for aggregation pipelines that run in MongoDB Compass.

By default, Max Time MS is set to 60000 milliseconds, or 60 seconds. Consider raising this value if you have a large collection or your operations frequently time out. Alternatively, consider lowering the Max Time MS value to quickly identify inefficient or resource-intensive pipeline operations.

If you already specified a maxTimeMS value in the Compass Settings panel, the command line, or a configuration file, the Max Time MS that you specify for your pipeline must be lower than the limit you previously specified.

If your aggregation operation goes over the time limit, Compass raises a timeout error.


On the Aggregations tab, click More Options

More Options dropdown.

Next to the Max Time MS field, enter a numeric value to set as the maximum amount of time in milliseconds that an aggregation pipeline can run.

For example, to set a 5 second limit, enter 5000.


Specify Custom Collation For Your Pipeline


Export Aggregation Pipeline Results