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

Count accepts negative skip values

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 2.0.6, 2.2.0-rc0
    • 2.3.0
    • Querying
    • Major Change
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: