<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53: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>[JAVA-760] Document that MongoClient doesn&apos;t throw an exception on connection failure</title>
                <link>https://jira.mongodb.org/browse/JAVA-760</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;When creating a new MongoClient instance with valid host/port parameters, but no MongoDB running there, I would expect a MongoException to be thrown. This is not the case. I can even use the MongoClient instance to get a DB instance via getDB() and subsequently a collection instance via getCollection(), again without being actually connected and any exception. I also tried getConnector().isOpen() to verify whether the connection was established and it returned true, without a running server. The latter issue might be me misinterpreting the API though.&lt;/p&gt;

&lt;p&gt;Others (see user &quot;litiales&quot;) are &lt;a href=&quot;http://stackoverflow.com/questions/13994513/mongodb-and-java&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;observing&lt;/a&gt; this as well.&lt;/p&gt;</description>
                <environment></environment>
        <key id="65563">JAVA-760</key>
            <summary>Document that MongoClient doesn&apos;t throw an exception on connection failure</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="brevilo">Oliver Bock</reporter>
                        <labels>
                    </labels>
                <created>Sun, 17 Feb 2013 11:01:22 +0000</created>
                <updated>Mon, 28 Jan 2019 16:52:33 +0000</updated>
                            <resolved>Mon, 28 Jan 2019 16:52:33 +0000</resolved>
                                    <version>2.10.1</version>
                                                    <component>Documentation</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="2129413" author="ross@10gen.com" created="Mon, 28 Jan 2019 16:52:33 +0000"  >&lt;p&gt;I&apos;m going to close this ticket as &quot;Won&apos;t Fix&quot;.  &lt;/p&gt;

&lt;p&gt;With distributed systems there is a level of complexity with regards to what being &quot;connected&quot; means.&#160; MongoDB is a highly available and scalable database, it is designed to be able to handle failures that typically occur in distributed systems. This is why we have concepts such as&#160;&lt;tt&gt;WriteConcern&lt;/tt&gt; and &lt;tt&gt;readPreference&lt;/tt&gt;, allowing a user to specify what is acceptable when it comes to any given operation.&lt;/p&gt;

&lt;p&gt;The driver has worked this way for 10 years and while it may come as a surprise to some users that the driver doesn&apos;t immediately report connectivity issues, the benefits of the pattern have proven themselves over time. There are various &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.9/driver/reference/monitoring/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;monitoring APIs&lt;/a&gt; that users have found useful with regards to understanding more about connection status - these can be found with the [main documentation| &lt;a href=&quot;http://mongodb.github.io/mongo-java-driver/3.9/driver/reference/monitoring/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;monitoring aois&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                            <comment id="272325" author="brevilo" created="Thu, 21 Feb 2013 18:46:18 +0000"  >&lt;blockquote&gt;
&lt;p&gt;I don&apos;t think we&apos;re going to change this behavior, but I agree that it should be documented.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Agreed, the behaviour is ok when you know what to expect, and when.&lt;/p&gt;

&lt;p&gt;Thanks.&lt;/p&gt;</comment>
                            <comment id="270522" author="jeff.yemin" created="Wed, 20 Feb 2013 00:04:19 +0000"  >&lt;p&gt;I don&apos;t think we&apos;re going to change this behavior, but I agree that it should be documented.&lt;/p&gt;

&lt;p&gt;This is probably obvious, but a simple thing to do to force a connection would be something like:&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;MongoClient client = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; MongoClient(...);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;client.getDB(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;admin&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;).command(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;ping&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;).throwOnError();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
</comment>
                            <comment id="268529" author="brevilo" created="Sun, 17 Feb 2013 12:25:35 +0000"  >&lt;p&gt;After all this seems more like a documentation issue than a bug.&lt;br/&gt;
Anyway, documenting this issue here might help others running into the same pitfall.&lt;/p&gt;</comment>
                            <comment id="268512" author="brevilo" created="Sun, 17 Feb 2013 11:36:49 +0000"  >&lt;p&gt;Update: I do get an exception as soon as I try to actually use the obtained DB instance for an online operation like dropDatabase(), so it seems the connection is established lazily. While I can understand this from a resource management point of view it seems rather unintuitive, in particular because the hostname is seemingly checked immediately as MongoClient throws an UnknownHostException. The same is true for connect(), which is just an alias for getDB(), because its name somewhat implies a connection is actually established when calling it.&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|hrexrb:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>43202</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="522">Java Sprint 20</customfieldvalue>
    <customfieldvalue id="552">Java Sprint 20</customfieldvalue>
    <customfieldvalue id="586">Java Sprint 21</customfieldvalue>
    <customfieldvalue id="587">Java Sprint 23</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>