[CXX-784] Add ability to use document::view with stream builder Created: 22/Dec/15  Updated: 19/Sep/16  Resolved: 15/Jun/16

Status: Closed
Project: C++ Driver
Component/s: None
Affects Version/s: 3.0.0-rc0
Fix Version/s: 3.0.2

Type: New Feature Priority: Major - P3
Reporter: Samantha Ritter (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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.



 Comments   
Comment by Githook User [ 15/Jun/16 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: CXX-784 Allow stream in of doc or array views
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/df8a3a3a9900b57d231465fc2618203834cf8c90

Comment by Andrew Morrow (Inactive) [ 14/Jun/16 ]

https://github.com/mongodb/mongo-cxx-driver/pull/495

Comment by Andrew Morrow (Inactive) [ 23/Feb/16 ]

This seem worth doing, queueing for 3.1.0

Generated at Wed Feb 07 22:00:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.