[SERVER-7718] Timestamp constructor in shell should take seconds instead of milliseconds Created: 20/Nov/12  Updated: 26/Oct/15  Resolved: 01/Mar/13

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

Type: Bug Priority: Major - P3
Reporter: Shaun Verch Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 1
Labels: breaking
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DOCS-1211 Timestamp is stored in seconds but di... Closed
Related
related to SERVER-7437 jsonString does not handle Timestamps... Closed
is related to SERVER-8639 toJson produces incorrect shell TimeS... Closed
Backwards Compatibility: Major Change
Operating System: ALL
Participants:

 Description   

Behavior:
mongos> db.test.insert(

{"t":new Timestamp(1234,5678)}

)
mongos> db.test.find()
{ "_id" : ObjectId("50a410317d03635de69f66eb"), "t" :

{ "t" : 1000, "i" : 5678 }

}
mongos>
Reason:
Timestamps are stored as seconds, but the shell divides by 1000 on the way in and multiplies by 1000 on the way out.

Fix:
Change constructor to take first param as seconds, not millis, and error if the value is greater than the maximum unix time in seconds (seconds between 1970 and 2038).



 Comments   
Comment by auto [ 01/Mar/13 ]

Author:

{u'date': u'2013-03-01T11:29:59Z', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-7718: more test cleanup related to Timestamp
Branch: master
https://github.com/mongodb/mongo/commit/d65b141de63340c84563be8c1d2ee13b06363e78

Comment by auto [ 28/Feb/13 ]

Author:

{u'date': u'2013-02-28T23:19:47Z', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-7718: JS Timestamp constructor now in seconds (not millis anymore)
Branch: master
https://github.com/mongodb/mongo/commit/6ea3fb90c6a90cad47501c4581c7206545f5e3f3

Generated at Thu Feb 08 03:15:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.