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

Add ability to use document::view with stream builder

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-rc0
    • Fix Version/s: 3.0.2
    • Component/s: None
    • Labels:
      None
    • Sprint:
      Platforms 16 (06/24/16)

      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

            Assignee:
            acm Andrew Morrow
            Reporter:
            samantha.ritter Samantha Ritter
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: