[SERVER-5973] Aggregation $sort should correctly handle dates before 1970 Created: 31/May/12  Updated: 11/Jul/16  Resolved: 01/Jun/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 2.1.2

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

> db.foo.insert({d:ISODate('1950-01-01')})
> db.foo.insert({d:ISODate('1980-01-01')})
> db.foo.find().sort({d:1})
{ "_id" : ObjectId("4fc79a7c3c6de6e31566ec2c"), "d" : ISODate("1950-01-01T00:00:00Z") }
{ "_id" : ObjectId("4fc79a7f3c6de6e31566ec2d"), "d" : ISODate("1980-01-01T00:00:00Z") }
> db.foo.aggregate({$sort:{d:1}})
{
	"result" : [
		{
			"_id" : ObjectId("4fc79a7f3c6de6e31566ec2d"),
			"d" : ISODate("1980-01-01T00:00:00Z")
		},
		{
			"_id" : ObjectId("4fc79a7c3c6de6e31566ec2c"),
			"d" : ISODate("1950-01-01T00:00:00Z")
		}
	],
	"ok" : 1
}



 Comments   
Comment by auto [ 01/Jun/12 ]

Author:

{u'login': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'redbeard0531@gmail.com'}

Message: Aggregation $sort for dates before 1970 SERVER-5973
Branch: master
https://github.com/mongodb/mongo/commit/7e3ec9e15190fec7123690804b426a1a1f58733f

Generated at Thu Feb 08 03:10:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.