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

Aggregation $sort should correctly handle dates before 1970

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.2
    • Affects Version/s: None
    • Component/s: Aggregation Framework
    • Labels:
      None
    • ALL

      > 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
      }
      

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

              Created:
              Updated:
              Resolved: