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

Invalid sorting of infinity and -infinity

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.1
    • Affects Version/s: 1.4.0
    • Component/s: Index Maintenance, Querying
    • None
    • Environment:
      Linux (Ubuntu 9.10 on Asus Eee PC 901)
    • Minor Change

      Sorting of infinity and -infinity does not produce expected results:

      > db.test.save(

      {number: 1}

      )
      > db.test.save(

      {number: 2}

      )
      > db.test.save(

      {number: 3}

      )
      > db.test.save(

      {number: Infinity}

      )
      > db.test.save(

      {number: -Infinity}

      )
      > db.test.find().sort(

      {"number": 1}

      )

      { "_id" : ObjectId("4bbdd056ac64d9763fe0bccf"), "number" : Infinity } { "_id" : ObjectId("4bbdd059ac64d9763fe0bcd0"), "number" : -Infinity } { "_id" : ObjectId("4bbdd04dac64d9763fe0bccc"), "number" : 1 } { "_id" : ObjectId("4bbdd04fac64d9763fe0bccd"), "number" : 2 } { "_id" : ObjectId("4bbdd051ac64d9763fe0bcce"), "number" : 3 }

      The expected order is [-Infinity, 1, 2, 3, Infinity].

            Assignee:
            dwight@mongodb.com Dwight Merriman
            Reporter:
            tomikall Tomi Kallio
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: