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

Count accepts negative skip values

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.0.6, 2.2.0-rc0
    • Fix Version/s: 2.3.0
    • Component/s: Querying
    • Labels:
    • Backwards Compatibility:
      Major Change
    • Operating System:
      ALL

      Description

      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)

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: