[CXX-673] How do you concatenate a view onto a sub_document? Created: 22/Sep/15 Updated: 16/Nov/21 Resolved: 21/Oct/15 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | API, Implementation |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Ethan Brown | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux |
||
| Issue Links: |
|
||||||||
| Description |
|
I'm wondering how to concatenate a document view onto an existing subview. Currently the _core is a private member variable, so my workaround was to fork the repo, make _core public and call: sub_document o; Is there a better way to do this? |
| Comments |
| Comment by Andrew Morrow (Inactive) [ 21/Oct/15 ] | ||||||||||
|
Fixed in | ||||||||||
| Comment by Ethan Brown [ 21/Oct/15 ] | ||||||||||
|
Yeah that's exactly what I needed, thanks! | ||||||||||
| Comment by Andrew Morrow (Inactive) [ 19/Oct/15 ] | ||||||||||
|
etano - This should be resolved by the commit mentioned in | ||||||||||
| Comment by Andrew Morrow (Inactive) [ 07/Oct/15 ] | ||||||||||
|
Hi etano - Yes, please see the work in | ||||||||||
| Comment by Ethan Brown [ 07/Oct/15 ] | ||||||||||
|
Any update on this? If I made a pull request where I just write a function to concatenate in basic::builder::document, what are the odds that it will be accepted? | ||||||||||
| Comment by Mira Carey [ 25/Sep/15 ] | ||||||||||
|
Unfortunately not. While there's little currently in the way (the stream and basic builders are stateless outside of holding a single core object), I'm not sure I want to guarantee that forever. I'd much rather ensure that anything you can do with one, you can do with the other. | ||||||||||
| Comment by Ethan Brown [ 25/Sep/15 ] | ||||||||||
|
Thanks for your help! The patch you describe would be perfect! With the first route, the way I have things abstracted, I am given a basic::builder::document. Is there any way to safely cast a basic::builder::document into a stream::builder::document? | ||||||||||
| Comment by Mira Carey [ 24/Sep/15 ] | ||||||||||
|
You're quite right, there's definitely a deficiency with the basic builder in terms of concatenation. If you're looking for something that works out of the box now you can try the stream builder:
which gives you:
I've also got a quick patch I'm going to start working through code review to add the same system to the basic builder, so you'll be able to:
I'll update this ticket once I have that up (though the final feature may evolve differently). |