[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); > date.getTime(); > db.driver_test.insert( { "dob" : date }); > doc = db.driver_test.findOne(); > doc.dob > doc.dob.getTime(); > 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 |