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

Use the $currentDate operator to update the current timestamp

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: WiredTiger
    • Labels:
      None

      Description

      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?

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: