Datetime out of range exception should mention datetime_conversion feature

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Unknown
    • 4.6
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      InvalidBSON exception for out of range datetimes should mention the datetime_conversion feature:

      >>> d = encode({'a': DatetimeMS(-2<<50)})
      >>> decode(d)
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/Users/shane/git/mongo-python-driver/bson/__init__.py", line 1070, in decode
          return _bson_to_dict(data, opts)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
      bson.errors.InvalidBSON: year -69387 is out of range
      

      Perhaps something like:

      bson.errors.InvalidBSON: year -69387 is out of range (Use CodecOptions(datetime_conversion=DATETIME_AUTO) or MongoClient(datetime_conversion='DATETIME_AUTO'))
      

            Assignee:
            Jib Adegunloye
            Reporter:
            Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: