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

Use the $currentDate operator to update the current timestamp

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: WiredTiger
    • None

      The authLog structure is as follows :

      { "_id": NumberInt("0"), "la": ISODate("2020-12-04T01:25:54.054Z"), }

      ,

      Then I use the following script operation:

      for(var i = 0;i<2000;i++)

      { db.authLog.updateOne(\{"_id":i}

      , {$currentDate: {"la":true}});
      }

      Then I discovered that it is possible that the update timestamp with a larger id is smaller than the update timestamp with a smaller id.E.g :

      { "_id": NumberInt("100"), "la": ISODate("2020-12-04T01:25:54.054Z"), }

      ,

      { "_id": NumberInt("201"), "la": ISODate("2020-12-04T01:25:54.052Z"), }

      .

      Why does this happen and how to solve it?

        1. journal.zip
          1.12 MB
        2. metrics.zip
          24 kB

            Assignee:
            edwin.zhou@mongodb.com Edwin Zhou
            Reporter:
            hellotudou@outlook.com pan chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: