[SERVER-1028] Pre-Epoch Dates Converted to Future Dates Created: 16/Apr/10  Updated: 16/Apr/10  Resolved: 16/Apr/10

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

Type: Bug Priority: Critical - P2
Reporter: Durran Jordan Assignee: Kyle Banker
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Major Change
Participants:

 Description   

When inserting pre-epoch dates, all dates get converted to incorrect future dates on the database side.

To reproduce from the shell:

> date = new Date(1950, 1, 1);
"Wed Feb 01 1950 00:00:00 GMT-0500 (EST)"

> date.getTime();
-628455600000

> db.driver_test.insert(

{ "dob" : date }

);

> doc = db.driver_test.findOne();
{
"_id" : ObjectId("4bc88e3b65e31b7855e310a5"),
"dob" : "Tue Jan -2147483647 584556000 14:25:52 GMT-0500 (EST)"
}

> doc.dob
"Tue Jan -2147483647 584556000 14:25:52 GMT-0500 (EST)"

> doc.dob.getTime();
18446743445253951000

> db.driver_test.find({ "dob" : { $lt : new Date() }});

> db.driver_test.find({ "dob" : { $gt : new Date() }});

{ "_id" : ObjectId("4bc88e3b65e31b7855e310a5"), "dob" : "Tue Jan -2147483647 584556000 14:25:52 GMT-0500 (EST)" }

mongoexport also exports a bad time:

{ "_id" :

{ "$oid" : "4bc88e3b65e31b7855e310a5" }

, "dob" :

{ "$date" : 18446743445253951616 }

}

The current workaround that I can see if converting all times that we are going to store to longs and convert back and forth on the application side... This has a side effect of needing to do a large migration on our part.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 16/Apr/10 ]

see SERVER-405

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