<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:38:19 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>[CSHARP-970] MongoServer.GetDatabase does not return the same instance</title>
                <link>https://jira.mongodb.org/browse/CSHARP-970</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;According to the docs, MongoServer.GetDatabase should return the same instance when the same database settings (e.g. database name) are used. However, the following test fails:&lt;/p&gt;

&lt;p&gt;        void describe_get_database()&lt;br/&gt;
        {&lt;br/&gt;
            MongoServer server = null;&lt;br/&gt;
            MongoDatabase db = null;&lt;br/&gt;
            MongoDatabase db2 = null;&lt;br/&gt;
            string dbName = null;&lt;/p&gt;

&lt;p&gt;            before = () =&amp;gt;&lt;br/&gt;
            &lt;/p&gt;
{
                var client = new MongoClient(&quot;mongodb://localhost&quot;);
                server = client.GetServer();

                dbName = &quot;test&quot;;
                db = server.GetDatabase(dbName);
            }
&lt;p&gt;;&lt;/p&gt;

&lt;p&gt;            act = () =&amp;gt; db2 = server.GetDatabase(dbName);&lt;/p&gt;

&lt;p&gt;            context&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;when the database name is the same&amp;quot;&amp;#93;&lt;/span&gt; = () =&amp;gt;&lt;br/&gt;
            &lt;/p&gt;
{
                it[&quot;should return the same database instance&quot;] =
                    () =&amp;gt; db2.should_be_same(db);
            }
&lt;p&gt;;&lt;br/&gt;
        }&lt;/p&gt;

&lt;p&gt;Have I misunderstood the documentation as looking through the source code it appears that GetDatabase always returns a new MongoDatabase instance.&lt;/p&gt;</description>
                <environment></environment>
        <key id="135917">CSHARP-970</key>
            <summary>MongoServer.GetDatabase does not return the same instance</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="9">Done</resolution>
                                        <assignee username="robert@mongodb.com">Robert Stam</assignee>
                                    <reporter username="benfosterdev">Ben Foster</reporter>
                        <labels>
                    </labels>
                <created>Sun, 11 May 2014 12:11:34 +0000</created>
                <updated>Thu, 2 Apr 2015 18:27:42 +0000</updated>
                            <resolved>Mon, 12 May 2014 13:39:54 +0000</resolved>
                                    <version>1.9</version>
                                    <fixVersion>1.9.1</fixVersion>
                                    <component>Documentation</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="580585" author="rstam" created="Mon, 12 May 2014 13:39:55 +0000"  >&lt;p&gt;Corrected XML doc comments.&lt;/p&gt;</comment>
                            <comment id="580583" author="xgen-internal-githook" created="Mon, 12 May 2014 13:37:10 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-970&quot; title=&quot;MongoServer.GetDatabase does not return the same instance&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-970&quot;&gt;&lt;del&gt;CSHARP-970&lt;/del&gt;&lt;/a&gt;: Correct doc comments for GetDatabase.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/e39d6335d7e2113cd85bc6e294d29bb21eeb5fcf&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/e39d6335d7e2113cd85bc6e294d29bb21eeb5fcf&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="580579" author="xgen-internal-githook" created="Mon, 12 May 2014 13:33:04 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;name&apos;: u&apos;rstam&apos;, u&apos;email&apos;: u&apos;robert@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-970&quot; title=&quot;MongoServer.GetDatabase does not return the same instance&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-970&quot;&gt;&lt;del&gt;CSHARP-970&lt;/del&gt;&lt;/a&gt;: Correct doc comments for GetDatabase.&lt;br/&gt;
Branch: v1.x&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/commit/259b762292a8b3217fbf84ccd410908e71a18a89&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/commit/259b762292a8b3217fbf84ccd410908e71a18a89&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="579938" author="rstam" created="Sun, 11 May 2014 16:54:39 +0000"  >&lt;p&gt;If you can hold on to the MongoDatabase instance and use it repeatedly you will create slightly less work for the garbage collector.&lt;/p&gt;

&lt;p&gt;But MongoDatabase is a light weight class that would be cheap to create and garbage collect, so either way is fine.&lt;/p&gt;</comment>
                            <comment id="579925" author="benfosterdev" created="Sun, 11 May 2014 16:22:39 +0000"  >&lt;p&gt;Hi Robert,&lt;/p&gt;

&lt;p&gt;Is there any reason why we should keep hold of the MongoDatabase instance&lt;br/&gt;
or is it fine to create it each time we make a query?&lt;/p&gt;

&lt;p&gt;Thanks&lt;br/&gt;
Ben&lt;/p&gt;
</comment>
                            <comment id="579906" author="rstam" created="Sun, 11 May 2014 15:34:17 +0000"  >&lt;p&gt;Sorry. The documentation is wrong. GetDatabase will return a new instance of MongoDatabase each time it is called.&lt;/p&gt;

&lt;p&gt;We will get the documentation corrected.&lt;/p&gt;

&lt;p&gt;Thanks for reporting this.&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|hryqzj:</customfieldvalue>

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