Uploaded image for project: 'Rust Driver'
  1. Rust Driver
  2. RUST-884

DateTimes between the year 10,000 and 99,999 cannot be deserialized

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • bson-2.0.0-beta.3
    • Affects Version/s: None
    • Component/s: BSON
    • None

      Due to a typo in the datetime deserialization logic, datetimes between the year 10,000 and 99,999 cannot be deserialized from Document. This is because, internally, the relaxed extended JSON format of the date is used for those years when it's supposed to stop at 9,999 (with canonical being used for the rest of the range).

      repro:

          let d = bson::DateTime::from_millis(253402300800000);
          let doc = doc! { "d": d };
      
          #[derive(Deserialize, Debug)]
          struct D {
              d: DateTime
          }
      
          println!("{:?}", bson::from_document::<D>(doc));
      

            Assignee:
            patrick.freed@mongodb.com Patrick Freed
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: