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

Use the $currentDate operator to update the current timestamp

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • WiredTiger
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: