-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Labels:
The returnKey and maxScan options to find are passed using a different format for legacy OP_QUERY find and the find command (new in 3.2). Therefore, passing a literal $returnKey or $maxScan as part of the argument to a .find() is no longer supported in the shell:
./mongo --readMode commands > db.c.drop() > db.c.insert({}) > db.c.find({$query: {}, $maxScan: 5}) assert: command failed: { "waitedMS" : NumberLong(0), "ok" : 0, "errmsg" : "unknown top level operator: $query", "code" : 2 }
Commit ffdb57ed20b introduced cursor.returnKey() and cursor.maxScan() helpers, which are now the official way to set these options. In the 3.2 manual, we should replace the $returnKey documentation (http://docs.mongodb.org/manual/reference/operator/meta/returnKey/) with a page documenting the cursor.returnKey() method. Similarly, we should replace http://docs.mongodb.org/manual/reference/operator/meta/maxScan/ with a page documenting the cursor.maxScan() method.