ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.7.0, 4.6.2
    • Affects Version/s: 4.2.0
    • Component/s: None
    • None
    • None
    • C Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Regression in 4.2.0. Copying a built

      Reproducer:

      TEST_CASE("HELP-101966: builder appends empty string value", "[bsoncxx::builder::basic]") {
          using namespace builder::basic;
      
          // An empty string element copied out of a document and re-appended must
          // remain a string, not become null.
          builder::basic::document source;
          builder::basic::document copy;
          builder::basic::document expected;
      
          source.append(kvp("foo", ""));
          expected.append(kvp("foo", ""));
      
          auto const elem = source.view()["foo"];
      
          copy.append(kvp(std::string{elem.key()}, elem.get_value()));
      
          viewable_eq_viewable(expected, copy); // Fails!
          //   expected = { "foo" : "" }
          //   basic = { "foo" : null }
      }
      

            Assignee:
            Ezra Chung
            Reporter:
            Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: