Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-743

Deprecate $currentDate update modifier

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: None
    • Labels:
      None
    • $i18n.getText("admin.common.words.hide")
      Key Status/Resolution FixVersion
      JAVA-3451 Fixed 4.1.0
      CSHARP-2767 Won't Do
      $i18n.getText("admin.common.words.show")
      #scriptField, #scriptField *{ border: 1px solid black; } #scriptField{ border-collapse: collapse; } #scriptField td { text-align: center; /* Center-align text in table cells */ } #scriptField td.key { text-align: left; /* Left-align text in the Key column */ } #scriptField a { text-decoration: none; /* Remove underlines from links */ border: none; /* Remove border from links */ } /* Add green background color to cells with FixVersion */ #scriptField td.hasFixVersion { background-color: #00FF00; /* Green color code */ } /* Center-align the first row headers */ #scriptField th { text-align: center; } Key Status/Resolution FixVersion JAVA-3451 Fixed 4.1.0 CSHARP-2767 Won't Do

      Downstream Change Summary

      The $currentDate update operator is being deprecated for MongoDB 4.4. As an alternative users can rewrite their updates using updates with aggregation pipelines and can use the $$NOW and $$CLUSTER_TIME aggregation system variables to access the current wall-clock and cluster time.

      In the following example, a document is updated using pipeline updates and $$NOW:

      > db.test.insert({_id: 1, value: null, lastUpdated: null})
      WriteResult({ "nInserted" : 1 })
      > db.test.find()
      { "_id" : 1, "value" : null, "lastUpdated" : null }
      > db.test.update({_id: 1}, [{$set: {value: 1, lastUpdated: "$$NOW"}}])
      WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
      > db.test.find()
      { "_id" : 1, "value" : 1, "lastUpdated" : ISODate("2019-10-01T13:27:55.583Z") }
      

      Description of Linked Ticket

      This can be better expressed using $$NOW and $$CLUSTER_TIME within a pipeline-style update and having two ways to do the same thing is confusing.

            Assignee:
            Unassigned Unassigned
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: