mongocxx how to build a document from a view?
I think, if I understand your question, that you should use builder::concatenate
:
auto cursor = db["friend"].find({});for (auto &&docView : cursor) { bsoncxx::builder::basic::document document1; document1.append(bsoncxx::builder::concatenate(docView)); document1.append(kvp("surl", "http://xxx")); document1.append(kvp("burl", "http://xxx"));}