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

ObjectId::new only generates 3 bytes of random data instead of 5

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • bson-1.2.3, bson-2.0.0-beta.3
    • Affects Version/s: 1.2.2, 2.0.0-beta.2
    • Component/s: BSON
    • None

      According to the ObjectID specification, 5 of the bytes are meant to be per-process and random. The BSON library currently has a bug however where the first and last bytes of this random section are always 0.

      repro:

      let oid = bson::oid::ObjectId::new();
      println!("{:?}", oid.bytes());       
      

      example output:

      [96, 254, 225, 198, 0, 42, 28, 13, 0, 2, 174, 186]
      

            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: