<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:55:15 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-1689] Why not provide a constructor with a String-Multi hosts?</title>
                <link>https://jira.mongodb.org/browse/JAVA-1689</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Now, I put mongo.host1,mongo.host2,mongo.host3 ... in my db.properties file,and config the MongoClient bean in beans.xml of Spring, like this:&lt;br/&gt;
&amp;lt;bean id=&quot;mongoClient&quot; ..&amp;gt;&lt;br/&gt;
&amp;lt;constructor-arg&amp;gt;&lt;br/&gt;
    &amp;lt;list&amp;gt;&lt;br/&gt;
        &amp;lt;bean id=&quot;m1&quot; ../&amp;gt;&lt;br/&gt;
        &amp;lt;bean id=&quot;m2&quot; ../&amp;gt;&lt;br/&gt;
        &amp;lt;bean id=&quot;m3&quot; ../&amp;gt;&lt;br/&gt;
    &amp;lt;/list&amp;gt;&lt;br/&gt;
&amp;lt;/bean&amp;gt;&lt;br/&gt;
if I add/remove host, I must change the two files,&lt;br/&gt;
So, why not we provide a constructor with one String param and parse it in method? &lt;/p&gt;

&lt;p&gt;Thanks~&lt;/p&gt;</description>
                <environment></environment>
        <key id="189686">JAVA-1689</key>
            <summary>Why not provide a constructor with a String-Multi hosts?</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="-1">Unassigned</assignee>
                                    <reporter username="yyam">yangyameng</reporter>
                        <labels>
                    </labels>
                <created>Mon, 16 Mar 2015 07:14:03 +0000</created>
                <updated>Wed, 11 Sep 2019 19:10:09 +0000</updated>
                            <resolved>Tue, 17 Mar 2015 10:13:20 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="856388" author="yyam" created="Wed, 18 Mar 2015 02:27:26 +0000"  >&lt;p&gt;Thank u very very very much~~&lt;/p&gt;

&lt;p&gt;and apologize for my unknowing...&lt;/p&gt;

</comment>
                            <comment id="855516" author="ross@10gen.com" created="Tue, 17 Mar 2015 10:13:20 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=yyam&quot; class=&quot;user-hover&quot; rel=&quot;yyam&quot;&gt;yyam&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for the ticket, currently the preferred way for multiple hosts is either to use a &lt;a href=&quot;http://api.mongodb.org/java/current/?com/mongodb/MongoClientURI.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;MongoClientURI&lt;/a&gt; which is fully parsed or alternatively you can provide a list of &lt;a href=&quot;http://api.mongodb.org/java/current/?com/mongodb/ServerAddress.html&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;ServerAddress&lt;/a&gt; to create the MongoClient instance.  &lt;/p&gt;

&lt;p&gt;Depending on your needs you should be able to parse a single list either by using a MongoClientURI or by building a list of ServerAddresses. Either way should be achievable by only setting the hosts in a single place but it might depend on how your application is configured and which libraries you are using.&lt;/p&gt;

&lt;p&gt;For future, the best place for questions regarding MongoDB usage or the Java driver specifics is the &lt;a href=&quot;https://groups.google.com/forum/#!forum/mongodb-user&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mongodb-user mailinglist&lt;/a&gt; or &lt;a href=&quot;http://stackoverflow.com&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stackoverflow&lt;/a&gt; as you will reach a boarder audience there, who may have already have a solution for this issue.&lt;/p&gt;

&lt;p&gt;Regards,&lt;/p&gt;

&lt;p&gt;Ross&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|hs75af:</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>