[SERVER-984] Invalid sorting of infinity and -infinity Created: 08/Apr/10  Updated: 12/Jul/16  Resolved: 05/Jul/11

Status: Closed
Project: Core Server
Component/s: Index Maintenance, Querying
Affects Version/s: 1.4.0
Fix Version/s: 1.9.1

Type: Bug Priority: Major - P3
Reporter: Tomi Kallio Assignee: Dwight Merriman
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux (Ubuntu 9.10 on Asus Eee PC 901)


Issue Links:
Related
related to SERVER-9277 Ranged index bounds do not permit ret... Closed
Backwards Compatibility: Minor Change
Participants:

 Description   

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].



 Comments   
Comment by auto [ 05/Jul/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-984 sorting of infinity
Branch: master
https://github.com/mongodb/mongo/commit/5961cc9ddc44eb8a5ed2cf36d672f04411fbbe52

Comment by auto [ 05/Jul/11 ]

Author:

{u'login': u'dwight', u'name': u'dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-984 sorting of infinity
Branch: master
https://github.com/mongodb/mongo/commit/5961cc9ddc44eb8a5ed2cf36d672f04411fbbe52

Comment by Eliot Horowitz (Inactive) [ 16/Jan/11 ]

This requires index version bump.

Generated at Thu Feb 08 02:55:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.