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

Aggregation $sort should correctly handle dates before 1970

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.2
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Operating System:
      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

            Assignee:
            redbeard0531 Mathias Stearn
            Reporter:
            redbeard0531 Mathias Stearn
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: