Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-5044

$dateToString aggregation with timezone outputs invalid ISO8601 string

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Builders
    • Labels:
      None
    • Hide

      DRIVERS-2620:
      The current default behavior of MongoDB's $dateToString aggregation expression is incorrect because it violates ISO 8601. (It tacks on a "Z" to the end of the string by default, which implies that it is in UTC [1], but in actually it's in the timezone of the local server.)

      This ticket proposes a number of routes to change the default behavior of $dateToString to bring it into compliance with ISO 8601.

      [1] https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC)

      1. If the query specifies a date format string, this is used.
      2. If no format string is specified, then
      a. If no timezone is specified or the UTC timezone is explicitly specified, the default format will continue to include the 'Z' suffix (yyyy-mm-ddThh:mm:ss.uuuZ).
      b. If a non-UTC timezone is specified, the default format will omit the 'Z' suffix (yyyy-mm-ddThh:mm:ss.uuu).

      Case 2b is the only change from prior behavior.

      This change was delivered in 7.1.0-rc0 and will NOT be backported.

      Show
      DRIVERS-2620: The current default behavior of MongoDB's $dateToString aggregation expression is incorrect because it violates ISO 8601. (It tacks on a "Z" to the end of the string by default, which implies that it is in UTC  [1] , but in actually it's in the timezone of the local server.) This ticket proposes a number of routes to change the default behavior of $dateToString to bring it into compliance with ISO 8601. [1]   https://en.wikipedia.org/wiki/ISO_8601#Coordinated_Universal_Time_(UTC ) 1. If the query specifies a date format string, this is used. 2. If no format string is specified, then a. If no timezone is specified or the UTC timezone is explicitly specified, the default format will continue to include the 'Z' suffix (yyyy-mm-ddThh:mm:ss.uuuZ). b. If a non-UTC timezone is specified, the default format will omit the 'Z' suffix (yyyy-mm-ddThh:mm:ss.uuu). Case 2b is the only change from prior behavior. This change was delivered in 7.1.0-rc0 and will NOT be backported.
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      This ticket was split from DRIVERS-2620, please see that ticket for a detailed description.

            Assignee:
            maxim.katcharov@mongodb.com Maxim Katcharov
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: