Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-91009

find command IDL prevents negative limit

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 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, ...

      (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 Unassigned
            Reporter:
            asya.kamsky@mongodb.com Asya Kamsky
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: