<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:59:13 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CXX-439] [C++11 Driver] Make lifetime of BSONObj more explicit to the user</title>
                <link>https://jira.mongodb.org/browse/CXX-439</link>
                <project id="11980" key="CXX">C++ Driver</project>
                    <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;When you call the next() function on a cursor, in the 26compat driver, it gives you back a BSONObj by value, however its lifetime is driven by some internal mechanism inside the cursor object.&lt;/p&gt;

&lt;p&gt;We have been bitten by this and quickly fixed it by explicitely calling the copy() method if our BSONObj outlives the next call to next().&lt;/p&gt;

&lt;p&gt;We do understand that from a performance point of view, and given that it was directly in the server before, that this behavior of no-copy is beneficial.&lt;/p&gt;

&lt;p&gt;However, in a brand new driver (such as the one you seem to be creating on master branch) it would be very nice to have better visibility on the lifetime on the object just by looking at what return the functions. &lt;br/&gt;
We think this is an important API design for a driver, especially now that C++11 has unique_ptr/shared_ptr or w/e type of lifetime mechanism you would need.&lt;/p&gt;</description>
                <environment></environment>
        <key id="172909">CXX-439</key>
            <summary>[C++11 Driver] Make lifetime of BSONObj more explicit to the user</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="andrew.morrow@mongodb.com">Andrew Morrow</assignee>
                                    <reporter username="antoine.hom@amadeus.com">Antoine Hom</reporter>
                        <labels>
                    </labels>
                <created>Fri, 5 Dec 2014 12:23:57 +0000</created>
                <updated>Fri, 24 Apr 2015 17:32:21 +0000</updated>
                            <resolved>Wed, 4 Mar 2015 20:23:36 +0000</resolved>
                                                    <fixVersion>0.1.0</fixVersion>
                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="843093" author="acm" created="Wed, 4 Mar 2015 20:22:49 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=antoine.hom%40amadeus.com&quot; class=&quot;user-hover&quot; rel=&quot;antoine.hom@amadeus.com&quot;&gt;antoine.hom@amadeus.com&lt;/a&gt; -&lt;/p&gt;

&lt;p&gt;Happy that helped. If you don&apos;t mind, I&apos;d like to close this ticket. If you have feedback on the new library we would be very interested to hear it, but the mongodb-dev mailing list is probably a better forum than this jira ticket.&lt;/p&gt;

&lt;p&gt;Feel free to-reopen if you feel the need.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Andrew&lt;/p&gt;</comment>
                            <comment id="835648" author="antoine.hom@amadeus.com" created="Tue, 24 Feb 2015 08:14:39 +0000"  >&lt;p&gt;Hello Andrew,&lt;/p&gt;

&lt;p&gt;Thanks a lot for the notification, I will take time in the next two weeks to take a deeper look at this new BSON library, but from the description you gave I can already see that it is going in the right direction! I will make sure to add feedbacks here after I dig into it.&lt;/p&gt;

&lt;p&gt;Cheers,&lt;br/&gt;
Antoine&lt;/p&gt;</comment>
                            <comment id="832660" author="acm" created="Thu, 19 Feb 2015 14:58:55 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=antoine.hom%40amadeus.com&quot; class=&quot;user-hover&quot; rel=&quot;antoine.hom@amadeus.com&quot;&gt;antoine.hom@amadeus.com&lt;/a&gt; -&lt;/p&gt;

&lt;p&gt;As you noted, we are developing a new C++ driver, using C++11 features, on the master branch. In the past few weeks the design of the BSON library component of that driver has stabilized. If you are interested, we would certainly appreciate your feedback on the design of the new BSON library, which I believe does provide the functionality you are requesting. In particular, the new BSON library provides different types for an unowned view of a BSON document, called bsoncxx::document::view, and a unique owning handle to a BSON document, called bsoncxx::document::value. Most API methods that return BSON will return a document::view, but you can construct a document::value from a document::view to get an owning copy.&lt;/p&gt;

&lt;p&gt;There are two additional things to consider:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The value type doesn&apos;t really offer any BSON methods. It is purely a lifetime management mechanism. To actually treat a value as BSON, you must obtain a view of its contents.&lt;/li&gt;
	&lt;li&gt;The split between the view and value types is intended to make it clearer whether you own or not, but abuse of &apos;auto&apos; will obscure the difference in types, and therefore the difference in ownership semantics.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;We are interested in hearing your thoughts.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Andrew&lt;/p&gt;</comment>
                            <comment id="779412" author="acm" created="Fri, 5 Dec 2014 13:14:24 +0000"  >&lt;p&gt;Hi Antoine -&lt;/p&gt;

&lt;p&gt;Thank you for the feedback. As you note, we are working on a C++11 driver on the master branch. We are currently iterating on a draft of the core interfaces, which we hope to submit for internal review soon, and then public comment sometime in the next few weeks. So your timing is very good.&lt;/p&gt;

&lt;p&gt;It is likely that the first version of the new C&amp;#43;&amp;#43;11 driver will ship with a very minimal BSON API since we are focusing our efforts on the driver API first, and you can always use libbson (the C BSON library) to construct or read BSON. However, feedback like this is extremely useful as it will help inform the direction of the pure C&amp;#43;&amp;#43;11 BSON library that we intend to develop once the core driver interfaces are stabilized.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Andrew&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hs4j67:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>151405</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>