<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:37:47 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-2080] Document client.StartSession does not error on disconnected client</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2080</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;The invocation of `client.StartSession( aContext )` over a `*mongo.Client`&#160; should produce an error if the client has been previously disconnected (through `client.Disconnect( aContext )` ). Am I missing something from the DOCS?The invocation of `client.StartSession( aContext )` over a `*mongo.Client`&#160; should produce an error if the client has been previously disconnected (through `client.Disconnect( aContext )` ). Am I missing something from the DOCS?&lt;br/&gt;
To reproduce:&lt;/p&gt;

&lt;p&gt;```&lt;br/&gt;
import (&lt;br/&gt;
&quot;fmt&quot;&lt;br/&gt;
 &quot;context&quot; &lt;br/&gt;
&quot;go.mongodb.org/mongo-driver/mongo&quot;&lt;br/&gt;
 &quot;go.mongodb.org/mongo-driver/mongo/options&quot;&lt;br/&gt;
)&lt;/p&gt;

&lt;p&gt;func main() {&lt;br/&gt;
&#160; &#160; clientMongo, err := mongo.Connect(context.Background(), options.Client().ApplyURI( someUriYouProvide ))&lt;br/&gt;
&#160; &#160;&lt;br/&gt;
&#160; &#160; if err != nil &lt;/p&gt;
{

&#160; &#160; &#160; fmt.Printf(&quot;Should not error on creating a new valid adapter: %s \n.&quot;, err)
&#160; &#160; }

&lt;p&gt;&#160; &#160; err = clientMongo.Disconnect(context.Background()) // let simulate a connection loss&lt;br/&gt;
&#160; &#160; if err != nil &lt;/p&gt;
{
&#160; &#160; &#160; fmt.Printf(&quot;error on disconnect: %s \n&quot;, err)
&#160; &#160; }
&lt;p&gt;&#160; &#160; // every operations over a Collection (obtained before the Disconnect) will now fail with an error, as expected&lt;br/&gt;
&#160; &#160; mongoSession, err := clientMongo.StartSession()&lt;br/&gt;
&#160; &#160; if err == nil &lt;/p&gt;
{
&#160; &#160; &#160; fmt.Println(&quot;should give error on starting session with DISCONNECTED mongo client&quot;)
&#160; &#160; }
&lt;p&gt;}&lt;br/&gt;
```&lt;/p&gt;</description>
                <environment></environment>
        <key id="1818042">GODRIVER-2080</key>
            <summary>Document client.StartSession does not error on disconnected client</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</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="benji.rewis@mongodb.com">Benji Rewis</assignee>
                                    <reporter username="ottins1995@gmail.com">Marco Ottina</reporter>
                        <labels>
                            <label>post-5.0</label>
                    </labels>
                <created>Wed, 14 Jul 2021 09:22:43 +0000</created>
                <updated>Sat, 28 Oct 2023 11:37:45 +0000</updated>
                            <resolved>Thu, 29 Jul 2021 22:21:44 +0000</resolved>
                                                    <fixVersion>1.7.1</fixVersion>
                                    <component>Connections</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="3978868" author="xgen-internal-githook" created="Tue, 3 Aug 2021 19:13:47 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Benjamin Rewis&apos;, &apos;email&apos;: &apos;32186188+benjirewis@users.noreply.github.com&apos;, &apos;username&apos;: &apos;benjirewis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2080&quot; title=&quot;Document client.StartSession does not error on disconnected client&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2080&quot;&gt;&lt;del&gt;GODRIVER-2080&lt;/del&gt;&lt;/a&gt; Document that StartSession does not error on disconnected client (#709)&lt;br/&gt;
Branch: release/1.7&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/50c091af37fe516db57e24780042d574b4a62df4&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/50c091af37fe516db57e24780042d574b4a62df4&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3971831" author="benji.rewis" created="Thu, 29 Jul 2021 22:21:44 +0000"  >&lt;p&gt;Updated documentation will be available in version 1.7.1 of the Go driver.&lt;/p&gt;</comment>
                            <comment id="3971829" author="xgen-internal-githook" created="Thu, 29 Jul 2021 22:20:46 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Benjamin Rewis&apos;, &apos;email&apos;: &apos;32186188+benjirewis@users.noreply.github.com&apos;, &apos;username&apos;: &apos;benjirewis&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2080&quot; title=&quot;Document client.StartSession does not error on disconnected client&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2080&quot;&gt;&lt;del&gt;GODRIVER-2080&lt;/del&gt;&lt;/a&gt; Document that StartSession does not error on disconnected client (#709)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/ea04a2c8f126ed3bc2a7dd35e3309571381233dc&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/ea04a2c8f126ed3bc2a7dd35e3309571381233dc&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3970777" author="JIRAUSER1261169" created="Thu, 29 Jul 2021 15:38:46 +0000"  >&lt;p&gt;Thank you so much for your kind help and replies.&lt;/p&gt;</comment>
                            <comment id="3970598" author="benji.rewis" created="Thu, 29 Jul 2021 14:53:12 +0000"  >&lt;p&gt;No problem. Here&apos;s a PR to document this behavior on &lt;tt&gt;client.StartSession&lt;/tt&gt;&#160;&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/pull/709&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/pull/709&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="3969997" author="JIRAUSER1261169" created="Thu, 29 Jul 2021 10:16:53 +0000"  >&lt;p&gt;First of all, thank you so much for your reply.&lt;br/&gt;
In fact, a Ping call would be sufficient to spot the disconnection.&lt;/p&gt;


&lt;p&gt;It would be great if You would add that line to the Docs. Thank you so much.&lt;/p&gt;</comment>
                            <comment id="3968892" author="benji.rewis" created="Wed, 28 Jul 2021 18:40:08 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ottins1995%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;ottins1995@gmail.com&quot;&gt;ottins1995@gmail.com&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;Thanks again for your report. &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/mongo/client.go#L272-L320&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Client.StartSession&lt;/a&gt; begins a session in the driver; it does not actually reach out to the server. StartSession simply constructs a new &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/mongo/client.go#L315-L319&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;sessionImpl&lt;/a&gt; with the correct options and returns it to the caller. Because it does not reach out to the server, the StartSession method will not know that the client is currently disconnected, so it cannot return that error. However, attempting to use the session created in StartSession to communicate with the server&#160;&lt;em&gt;should&lt;/em&gt;&#160;result in a &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/master/mongo/errors.go#L27&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongo.ErrClientDisconnected&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If it would be helpful, we can add a small line in the documentation for that method clarifying that it does not actually perform any network calls.&lt;/p&gt;</comment>
                            <comment id="3943586" author="kevin.albertson" created="Thu, 15 Jul 2021 14:42:30 +0000"  >&lt;p&gt;Hello &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ottins1995%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;ottins1995@gmail.com&quot;&gt;ottins1995@gmail.com&lt;/a&gt;, thank you for the report! We will further investigate this after we have completed high priority work for upcoming server support. Thank you for your patience.&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_10257" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Documentation Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11861"><![CDATA[Not Needed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hzcdnr:</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>