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

aggregation: add strptime functionality to parse string dates into ISODates

    Details

      Description

      Example:
      {$date: "2016-04-16T13:32:10"}
      would return the Date object ISODate("2016-04-16T13:32:10.000Z")

        Issue Links

          Activity

          Hide
          afchin Annie Chin added a comment -

          I wanted to try implementing this ticket,
          but I'm a little confused about what it means. Is the point to allow
          ISODate to take in a string OR its current parameters (and then parse
          the string and etc.)? Or is it to add a new expression called
          $strptime that takes in a string, parses the elements out, and then
          passes those elements to $ISODate to produce an ISODate?

          Show
          afchin Annie Chin added a comment - I wanted to try implementing this ticket, but I'm a little confused about what it means. Is the point to allow ISODate to take in a string OR its current parameters (and then parse the string and etc.)? Or is it to add a new expression called $strptime that takes in a string, parses the elements out, and then passes those elements to $ISODate to produce an ISODate?
          Hide
          eliot Eliot Horowitz added a comment -

          The latter, a new function called $stptime

          Show
          eliot Eliot Horowitz added a comment - The latter, a new function called $stptime
          Hide
          schwerin Andy Schwerin added a comment -

          The example from the description:

          Example:
          {$date: "2016-04-16T13:32:10"}
          would return the Date object ISODate("2016-04-16T13:32:10.000Z")

          suggests that the parser will presume that "no timezone provided" equals "UTC timezone". I suggest instead that we should issue an error if the user fails to provide a timezone.

          Show
          schwerin Andy Schwerin added a comment - The example from the description: Example: {$date: "2016-04-16T13:32:10"} would return the Date object ISODate("2016-04-16T13:32:10.000Z") suggests that the parser will presume that "no timezone provided" equals "UTC timezone". I suggest instead that we should issue an error if the user fails to provide a timezone.
          Hide
          arg20 Gabriel Zimmermann added a comment -

          Any ETA on this? I need this feature for my aggregation pipeline. I can group by date, but I need to calculate the offset of a document until the end of the `$group` and this is the only way I can think of.

          Show
          arg20 Gabriel Zimmermann added a comment - Any ETA on this? I need this feature for my aggregation pipeline. I can group by date, but I need to calculate the offset of a document until the end of the `$group` and this is the only way I can think of.

            People

            • Votes:
              11 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated: