Use Deserialize rather than Into for Document::insert?

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Rust Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      As a convenience, Document::insert accepts any value that's Into<Bson>. This is convenient but at odds with everywhere in the driver we provide convenience autoconversion, which uses Serialize.

      This has definitely caused user confusion, and understandably so. Should we switch the signature over to require that the type be Serialize? This has two major downsides:

      • It introduces fallibility
      • It makes it harder to make `serde` an optional feature (RUST-1992).

      Alternatively, we could add a specific note to the rustdoc for Document::insert for this situation, pointing at bson::to_bson as the solution.

            Assignee:
            Unassigned
            Reporter:
            Abraham Egnor
            None
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: