This version of the documentation is archived and no longer supported.




Deprecated in the mongo Shell since v3.2
Starting in v3.2, the $maxScan operator is deprecated in the mongo shell. In the mongo shell, use cursor.maxScan() instead.

Constrains the query to only scan the specified number of documents when fulfilling the query. Use one of the following forms:

db.collection.find( { <query> } )._addSpecial( "$maxScan" , <number> )
db.collection.find( { $query: { <query> }, $maxScan: <number> } )

Use this modifier to prevent potentially long running queries from disrupting performance by scanning through too much data.

←   $hint $max  →