Implement operator[] for bsoncxx::document::value

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      All of the usability methods for document reading are on the document::view class.  However, as a usability improvement, it would be nice to provide operator[] on the document::value class, which would delegate the real work to document::view under the hood:

      auto doc = make_document(kvp("a", 1));
      
      // currently
      auto a = doc.view()["a"].get_value(); 
      
      // also currently
      auto doc_view = doc.view();
      auto a = doc_view["a"].get_value();
      
      // proposed
      auto a = doc["a"].get_value();

            Assignee:
            Raymund Rodriguez (Inactive)
            Reporter:
            Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: