How can mongodb handle ObjectId timestamp beyond Tue, 19 Jan 2038? How can mongodb handle ObjectId timestamp beyond Tue, 19 Jan 2038? mongodb mongodb

How can mongodb handle ObjectId timestamp beyond Tue, 19 Jan 2038?


Unsigned 2,147,483,648 perfectly fits into 4 bytes. 4 bytes is enough to hold values up to 4,294,967,295, which is a unix epoch for Sunday, 7 February 2106 06:28:16 GMT.

If ObjectID's survive without changes till then, the timestamp part will start from 0, if you care:

> new Date();ISODate("2106-02-08T12:41:20.450Z")> db.t.insert({welcome:"from the future"});WriteResult({ "nInserted" : 1 })> db.t.find().pretty();{    "_id" : ObjectId("0001a7b306c389186a3a9323"),    "welcome" : "from the future"}> db.t.find()[0]._id.getTimestamp();ISODate("1970-01-02T06:07:47Z")