Replace JSONOptions.strict_date with JSONOptions.datetime_representation

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • 3.4
    • Affects Version/s: 3.4
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      In PYTHON-767 we added support for a strict_date option. The implementation matches the behavior of MongoDB 2.6 era mongoexport. That is, it outputs ISO-8601 format for post-epoch dates and $numberLong for pre-epoch dates.

      With the release of MongoDB 3.0, mongoexport started using ISO-8601 output for pre-epoch dates as well. However, it uses $numberLong for maxDate.

      Let's replace the unreleased strict_date boolean with a datetime_representation option, configured with an enum, and use that setting for all datetime output. Something like:

      class DatetimeRepresentation:
          # {$date: <int64>}
          LEGACY = 0
          # {$date: {$numberLong: <int64>}}
          NUMBERLONG = 1
          # {$date: <ISO-8601>}
          ISO8601 = 2
      

            Assignee:
            Shane Harvey
            Reporter:
            Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: