Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-2046

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

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      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();

      Attachments

        Activity

          People

            raymund.rodriguez@mongodb.com Raymund Rodriguez
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: