Docs Menu
Docs Home
/
MongoDB Manual
/ /

Query Timeouts

On this page

  • Specify a Time Limit for Queries
  • Learn More

You can specify a timeout for read operations to complete. If a query exceeds the specified time limit, MongoDB stops the query and the query does not return any results.

To prevent ongoing queries from negatively impacting deployment performance for long periods of time, specify a suitable query timeout for your application.

For details on how MongoDB stops queries that exceed a specified timeout, see cursor.maxTimeMS Behaviors.

To specify a time limit for a query, perform one of these actions:

← Query for Null or Missing Fields