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

Weird result with sort({$natural:-1})

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • ALL

    Description

      The {$natural:1} results are correct

      > db.foo.find({}).sort({$natural:-1}).itcount()
      500463
      > db.foo.find({}).sort({$natural:1}).itcount()
      647227
      > db.foo.find({}).sort({$natural:-1}).explain()
      {
      "cursor" : "ReverseCursor",
      "nscanned" : 500463,
      "nscannedObjects" : 500463,
      "n" : 500463,
      "millis" : 151,
      "indexBounds" : {

      }
      }
      > db.foo.find({}).sort({$natural:1}).explain()
      {
      "cursor" : "BasicCursor",
      "nscanned" : 647227,
      "nscannedObjects" : 647227,
      "n" : 647227,
      "millis" : 194,
      "indexBounds" : {

      }
      }

      Attachments

        Activity

          People

            mathias@mongodb.com Mathias Stearn
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: