Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1135

Replace JSONOptions.strict_date with JSONOptions.datetime_representation

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

      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@mongodb.com Shane Harvey
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: