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

Have no idea how to add bsoncxx::document::value to another document

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.0.1
    • Affects Version/s: None
    • Component/s: None
    • None

      Hello, folks!

      I'm using recent C++ driver (it's awesome)! But after deep reading of all examples I could not find any way how to add bsoncxx::document::value into existing document.

      I'm doing following:

        auto db = conn[fastnetmon_global_configuration.mongodb_database_name];
              std::string collection_name = "mitigations";
      
              auto doc = bsoncxx::builder::basic::document{};
              doc.append(bsoncxx::builder::basic::kvp("active", bsoncxx::types::b_bool{true}));
              doc.append(bsoncxx::builder::basic::kvp("mitigation_type", "blackhole"));
      
             bsoncxx::document::value details = bsoncxx::from_json(json_encoded_flow_spec);     
      

      But obvious try to add "details" as sub document failed:

      doc.append(bsoncxx::builder::basic::kvp("details", details);
      

      Could you help me? There are no docs in examples folder about adding another document cooked somewhere else.

            Assignee:
            matt.cotter Matt Cotter
            Reporter:
            pavel.odintsov Pavel Odintsov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: