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

Consider changing relaxed representation of dates before the epoch

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: Extended JSON
    • None
    • Needed

      The Relaxed Extended JSON format for DateTime specifies that dates before the epoch are represented the same as Canonical Extended JSON:

      {
          "$date": {
             "$numberLong": <64-bit signed integer giving ms relative to the epoch, as a string>}
      }	
      

      A user of the Java driver was very surprised by the behavior. The expectation was that dates before the epoch would be represented the same. And indeed, this is how mongoexport has worked since the 3.0 release (which is pointed out in the spec rationale:

      ~$ mongoexport -d test -c test
      2021-02-26T10:15:52.455-0500	connected to: localhost
      {"_id":{"$oid":"6039106dc6d0b365cd1f7454"},"d":{"$date":"2021-02-26T15:14:53.340Z"}}
      {"_id":{"$oid":"60391099c6d0b365cd1f7455"},"d":{"$date":"1931-11-10T07:45:32.962Z"}}
      2021-02-26T10:15:52.456-0500	exported 2 records
      

      Let's consider whether we should update the spec for Relaxed Extended JSON to match this behavior, which is probably what would be expected by most users.

            Assignee:
            Unassigned Unassigned
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: