<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:36:00 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>[GODRIVER-1246] Cursor.All() should end implicit session</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-1246</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Currently Collection.Find() returns a Cursor and an error.&lt;/p&gt;

&lt;p&gt;The new Cursor.All() method is very helpful, because it allows to load the cursor to a slice.&lt;/p&gt;

&lt;p&gt;However I see 1 major problem: the cursor &quot;API&quot; is exposed to the user, and he must take care of closing it. If I understand correctly, if you don&apos;t close it, there is a leak.&lt;/p&gt;

&lt;p&gt;As a developer and reviewer, it&apos;s very easy to miss a cursor that isn&apos;t closed.&lt;/p&gt;

&lt;p&gt;It would be simpler/safer for a user that calls .All() to close the cursor automatically.&lt;/p&gt;

&lt;p&gt;I see 2 solutions:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;defer close the cursor in Cursor.All() =&amp;gt; this is what mgo was doing&#160;&lt;a href=&quot;https://godoc.org/github.com/globalsign/mgo#Iter.All&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://godoc.org/github.com/globalsign/mgo#Iter.All&lt;/a&gt;&#160;(maybe it&apos;s already the case, but it&apos;s not documented &lt;a href=&quot;https://godoc.org/go.mongodb.org/mongo-driver/mongo#Cursor.All&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://godoc.org/go.mongodb.org/mongo-driver/mongo#Cursor.All&lt;/a&gt;&#160;)&lt;/li&gt;
	&lt;li&gt;expose a new method on Collection that: call Collection.Find(), check the error, defer close the cursor, call Cursor.All()&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="902444">GODRIVER-1246</key>
            <summary>Cursor.All() should end implicit session</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13201">Fixed</resolution>
                                        <assignee username="alice.thum@mongodb.com">Alice Thum</assignee>
                                    <reporter username="pierrre">Pierre Durand</reporter>
                        <labels>
                    </labels>
                <created>Wed, 21 Aug 2019 08:39:12 +0000</created>
                <updated>Sat, 28 Oct 2023 11:38:40 +0000</updated>
                            <resolved>Wed, 4 Sep 2019 15:28:26 +0000</resolved>
                                                    <fixVersion>1.1.1</fixVersion>
                                    <component>CRUD</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2408780" author="xgen-internal-githook" created="Thu, 5 Sep 2019 13:42:34 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Alice Thum&apos;, &apos;email&apos;: &apos;alice.thum@10gen.com&apos;}
&lt;p&gt;Message: Close cursor before returning from All.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1246&quot; title=&quot;Cursor.All() should end implicit session&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1246&quot;&gt;&lt;del&gt;GODRIVER-1246&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change-Id: I907f4113c4f8c8428b176622edcb2bedc34fc9a6&lt;br/&gt;
Branch: release/1.1&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/431fe7cb90f7390aec1ab359747119ff708c8207&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/431fe7cb90f7390aec1ab359747119ff708c8207&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2407679" author="alice.thum" created="Wed, 4 Sep 2019 18:50:40 +0000"  >&lt;p&gt;commit link:&#160;&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/9c2e0a94c89a134b506777bd620c83ecf754974a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/9c2e0a94c89a134b506777bd620c83ecf754974a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2407233" author="xgen-internal-githook" created="Wed, 4 Sep 2019 15:27:38 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;email&apos;: &apos;alice.thum@10gen.com&apos;, &apos;name&apos;: &apos;Alice Thum&apos;}
&lt;p&gt;Message: Close cursor before returning from All.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1246&quot; title=&quot;Cursor.All() should end implicit session&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1246&quot;&gt;&lt;del&gt;GODRIVER-1246&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Change-Id: I907f4113c4f8c8428b176622edcb2bedc34fc9a6&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/9c2e0a94c89a134b506777bd620c83ecf754974a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/9c2e0a94c89a134b506777bd620c83ecf754974a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2398321" author="alice.thum" created="Wed, 28 Aug 2019 19:37:39 +0000"  >&lt;p&gt;gerrithub link:&#160;&lt;a href=&quot;https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/466622&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.gerrithub.io/c/mongodb/mongo-go-driver/+/466622&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <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|hvaw87:</customfieldvalue>

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