Docs Menu

Docs HomeMongoDB Manual




Deprecated since v3.2

Starting in v3.2, the $maxTimeMS operator is deprecated in the mongo shell. In the mongo shell, use cursor.maxTimeMS() instead.

The $maxTimeMS operator specifies a cumulative time limit in milliseconds for processing operations on the cursor. MongoDB interrupts the operation at the earliest following interrupt point.

The mongo shell provides the cursor.maxTimeMS() method


You can also specify the option in either of the following forms:

db.collection.find( { $query: { }, $maxTimeMS: 100 } )
db.collection.find( { } )._addSpecial("$maxTimeMS", 100)

Interrupted operations return an error message similar to the following:

error: { "$err" : "operation exceeded time limit", "code" : 50 }
←  $max$min →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.