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

Add ability to use document::view with stream builder

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.0.2
    • 3.0.0-rc0
    • None
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: