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

ObjectId::new() doesn't work on wasm

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      Because ObjectId needs to get the current time, it panics in wasm, which can't get the current time via std (see: https://github.com/rust-lang/rust/issues/48564).

      Issue originally filed by sinhpham on GitHub (https://github.com/mongodb/bson-rust/issues/199):

      Due to using std::time::SystemTime.

      A potential solution is exposing a new_with_timestamp(n_secs_since_unix_epoch: u32) -> Self constructor. People who want to run on wasm can supply their own timestamp.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated: