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

Add ability to use document::view with stream builder

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.2
    • Affects Version/s: 3.0.0-rc0
    • Component/s: None
    • None

      Given some document::view sub_doc, it would be nice if the following worked:

      auto sub_doc = document{} << "b" << 1 << finalize;
      auto doc_builder = document{} << "a" << sub_doc.view();
      

      Currently, the core builder has no append overload that can take a document::view, so one of these workarounds has to be used:

      // build and append a b_document type
      builder << bsoncxx::types::b_document{sub_doc};
      
      // use the 'concatenate' helper in a new subdoc
      builder << open_document << concatenate(sub_doc) << close_document;
      

      Neither of these is ideal, it would be nice to have append with a document::view just work.

            Assignee:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Reporter:
            samantha.ritter@mongodb.com Samantha Ritter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: