-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.0.4, 2.1.0
-
Component/s: None
-
None
-
ALL
v0 indexes on 2.0.x and 2.1.x servers cannot find dates before the UNIX epoch:
> db.serverStatus().version 1.8.5 > db.dates.insert({_id: "before", date: new Date(-3600000)}) > db.dates.insert({_id: "after", date: new Date(3600000)}) > db.dates.ensureIndex({date: 1}) > db.dates.find({date: new Date(3600000)}) { "_id" : "after", "date" : ISODate("1970-01-01T01:00:00Z") } > db.dates.find({date: new Date(-3600000)}) { "_id" : "before", "date" : ISODate("1969-12-31T23:00:00Z") } // restart in same dbpath with 2.0.4 server here > db.serverStatus().version 2.0.4 > db.dates.find({date: new Date(3600000)}) { "_id" : "after", "date" : ISODate("1970-01-01T01:00:00Z") } > db.dates.find({date: new Date(-3600000)}) >
Note that after reindexing, the documents can then be found in the (now v1) index:
> db.dates.reIndex() [...] > db.dates.find({date: new Date(3600000)}) { "_id" : "after", "date" : ISODate("1970-01-01T01:00:00Z") } > db.dates.find({date: new Date(-3600000)}) { "_id" : "before", "date" : ISODate("1969-12-31T23:00:00Z") } >
Also this is reproduceable when explicitly creating v0 indexes on a 2.x server:
> db.serverStatus().version 2.1.0 > db.dates.drop() true > db.dates.insert({_id: "before", date: new Date(-3600000)}) > db.dates.insert({_id: "after", date: new Date(3600000)}) > db.dates.ensureIndex({date: 1}, {v: 0}) > db.dates.find({date: new Date(3600000)}) { "_id" : "after", "date" : ISODate("1970-01-01T01:00:00Z") } > db.dates.find({date: new Date(-3600000)}) >