Docs Home / Compass / Create an Aggregation Pipeline

Set Max Time MS for Aggregation Queries设置聚合查询的最大时间MS

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.使用聚合选项卡上的“最大时间MS”选项为在MongoDB Compass中运行的聚合管道指定以毫秒为单位的上限时间。

About this Task关于此任务

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.默认情况下,“最大时间MS”设置为60000毫秒,即60秒。如果您有大量的集合或操作经常超时,请考虑提高此值。或者,考虑降低最大时间MS值,以快速识别低效或资源密集型的管道操作。

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.如果已在Compass设置面板、命令行配置文件中指定了maxTimeMS值,则为管道指定的最大时间MS必须低于之前指定的限制。

If your aggregation operation goes over the time limit, Compass raises a timeout error.如果聚合操作超过时间限制,Compass将引发超时错误。

Steps步骤

1

Click Options单击“选项”

On the Aggregations tab, click Options在“聚合”选项卡上,单击“选项”

More Options dropdown.
2

Specify a Max Time MS value指定“最大时间MS”值

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.在“最大时间MS”字段旁边,输入一个数值,将其设置为聚合管道可以运行的最大时间量(毫秒)。

For example, to set a 5 second limit, enter 5000.例如,要设置5秒的限制,请输入5000

Learn More了解更多