Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7718

Timestamp constructor in shell should take seconds instead of milliseconds

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4.0-rc2
    • Affects Version/s: None
    • Component/s: None
    • Major Change
    • ALL

      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).

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            sverch Shaun Verch
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: