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

Add square bracket indexing to Document

    XMLWordPrintable

    Details

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

      Description

      By implementing the Index trait on Document, users can use square brackets to retrieve values like a Python dictionary. This is a familiar syntax from other BSON libraries and may be easier to read than the various getters we provide currently.
      e.g.

      let d = doc! { "x": 1 };
      let value: Option<&Bson> = d["x"];
      

       

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: