Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5901

Document new DBQuery helper methods in the shell

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 01112017-cleanup
    • 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.

            Assignee:
            ravind.kumar Ravind Kumar (Inactive)
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              8 years, 20 weeks, 3 days ago