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

Timestamp constructor in shell should take seconds instead of milliseconds

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.0-rc2
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Major Change
    • Operating System:
      ALL

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

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: