$maxTimeMS
Deprecated since v3.2
Starting in v3.2, the $maxTimeMS
operator is deprecated in themongo
shell. In the mongo
shell,use cursor.maxTimeMS()
instead.
New in version 2.6: The $maxTimeMS
operator specifies a cumulativetime limit in milliseconds for processing operations on thecursor. MongoDB interrupts the operation at the earliestfollowing interrupt point.
The mongo
shell provides the cursor.maxTimeMS()
method
- db.collection.find().maxTimeMS(100)
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 thefollowing:
- error: { "$err" : "operation exceeded time limit", "code" : 50 }