Add square bracket indexing to Document

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Fixed
    • Priority: Major - P3
    • bson-2.14.0
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      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"];
      

       

              Assignee:
              Jada Lilleboe
              Reporter:
              Patrick Freed
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: