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

bson-rust - PR #402: feat: add ability to generate ObjectId from SystemTime

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      Denys-Bushulyak has created PR #402: feat: add ability to generate ObjectId from SystemTime in bson-rust

      Issue Text:
      Hi, dear folks!

      This PR adds the ability to generate an ObjectId from SystemTime. I found it useful because sometimes there is a need to create records in MongoDB from the "past" and use the nice ability of MongoDB to sort by ObjectId.

      In the official documentation [page](https://www.mongodb.com/docs/manual/reference/method/ObjectId/#mongodb-method-ObjectId), there is a description of the ability to create an ObjectId from a hex and unix epoch timestamp, but I didn't find the ability to create one from a timestamp in the Rust Crate. However, since we are already there, I have decided to implement it using SystemTime as a first step. If you find it useful, I will be glad, because I think it would be better to extend the official crate rather than creating a separate one for this ability.

            Assignee:
            isabel.atkinson@mongodb.com Isabel Atkinson
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: