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

Aggregation $sort should correctly handle dates before 1970

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 2.1.2
    • Aggregation Framework
    • None
    • ALL

    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
      }

      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: