find command IDL prevents negative limit

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • Hide
      db.foo.find().limit(-2)
      db.foo.find().limit(2)
      // produce same query but {{singleBatch:true}} for former and false for latter
      db.runCommand({find:"foo", limit:-2})
      {
      	"ok" : 0,
      	"errmsg" : "Limit value must be non-negative, but received: -2",
      	"code" : 2,
      ...
      
      Show
      db.foo.find().limit(-2) db.foo.find().limit(2) // produce same query but {{singleBatch:true}} for former and false for latter db.runCommand({find:"foo", limit:-2}) { "ok" : 0, "errmsg" : "Limit value must be non-negative, but received: -2", "code" : 2, ...
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      (apparently implemented as part of SERVER-53061 or SERVER-53060)?

      find takes negative limit which means close the cursor after returning X documents. FindOne always used limit -1. However, this change to IDL added "no negative limit" to find command which is probably wrong.

            Assignee:
            Unassigned
            Reporter:
            Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: