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

Count accepts negative skip values

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.3.0
    • Affects Version/s: 2.0.6, 2.2.0-rc0
    • Component/s: Querying
    • Labels:
    • Major Change
    • ALL

      Count command happily accepts negative skip values, and subtracts them from the count result:

      > db.bar.drop()
      > for(i=0; i < 10; i++){db.bar.insert({a : i})}
      > db.bar.find().count(true)
      10
      > db.bar.find().skip(-5).count(true)
      15
      

      It should probably throw an error if you give it a negative skip (like it does if you leave out the "count" part)

            Assignee:
            sverch Shaun Verch
            Reporter:
            matulef Kevin Matulef
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: