<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:53:03 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-780] Expose MongoClientURI constructor for overriding default options</title>
                <link>https://jira.mongodb.org/browse/JAVA-780</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Overview: Making a case for this constructor to be public:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/MongoClientURI.java#L162&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/blob/1d2e6faa80aeb5287a26d0348f18f4b51d566759/src/main/com/mongodb/MongoClientURI.java#L162&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Within the MMS server implementation, we have a use case where MongoDB connections are configured via MongoURIs. And, we have application-specific default options that want to take precedence over the driver defaults. &lt;/p&gt;

&lt;p&gt;In the past, this was easy enough since MongoURI and MongoOptions were both mutable. However now that MongoClientURI and MongoClientOptions are both immutable, I&apos;m struggling for how to implement the same behavior without going through a deprecated alternative.&lt;/p&gt;

&lt;p&gt;Fwiw, it &lt;b&gt;appears&lt;/b&gt; that what I&apos;m looking for exactly is the package private constructor linked above, which would allow me to specify my own set of default options.&lt;/p&gt;

&lt;p&gt;(Encountered using 2.11.0-SNAPSHOT at githash 1d2e6faa80aeb5287a26d0348f18f4b51d566759, but looks unchanged on master.)&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</description>
                <environment></environment>
        <key id="67640">JAVA-780</key>
            <summary>Expose MongoClientURI constructor for overriding default options</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="9">Done</resolution>
                                        <assignee username="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="john.morales@mongodb.com">John Morales</reporter>
                        <labels>
                    </labels>
                <created>Thu, 7 Mar 2013 15:52:40 +0000</created>
                <updated>Tue, 19 Mar 2013 14:48:30 +0000</updated>
                            <resolved>Sat, 9 Mar 2013 22:15:39 +0000</resolved>
                                    <version>2.10.1</version>
                                    <fixVersion>2.11.0</fixVersion>
                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="286244" author="john.morales@10gen.com" created="Mon, 11 Mar 2013 14:43:21 +0000"  >&lt;p&gt;Awesome - thank you! Will try out this snapshot.&lt;/p&gt;</comment>
                            <comment id="285328" author="jeff.yemin" created="Sat, 9 Mar 2013 22:21:12 +0000"  >&lt;p&gt;Snapshot available: &lt;a href=&quot;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/2.11.0-SNAPSHOT/mongo-java-driver-2.11.0-20130309.221945-6.jar&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://oss.sonatype.org/content/repositories/snapshots/org/mongodb/mongo-java-driver/2.11.0-SNAPSHOT/mongo-java-driver-2.11.0-20130309.221945-6.jar&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="285321" author="jeff.yemin" created="Sat, 9 Mar 2013 22:15:39 +0000"  >&lt;p&gt;Constructor is public&lt;/p&gt;</comment>
                            <comment id="285319" author="auto" created="Sat, 9 Mar 2013 22:14:27 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-03-09T22:14:03Z&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-780&quot; title=&quot;Expose MongoClientURI constructor for overriding default options&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-780&quot;&gt;&lt;del&gt;JAVA-780&lt;/del&gt;&lt;/a&gt;: Made MongoClientURI constructor that takes a MongoClientOptions.Builder public&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/0cd926a386b83de5fe475c73e0fbff3064526998&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/0cd926a386b83de5fe475c73e0fbff3064526998&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="285275" author="bimargulies" created="Sat, 9 Mar 2013 20:16:19 +0000"  >&lt;p&gt;As I see it, the behavior of the constructor is what&apos;s nice. For example, one could turn autoconnectretry on in the options, and that would persist unless the URI asked otherwise.&lt;/p&gt;</comment>
                            <comment id="283680" author="john.morales@10gen.com" created="Thu, 7 Mar 2013 20:43:52 +0000"  >&lt;p&gt;Yes. But I mean if &lt;b&gt;any&lt;/b&gt; options are specified on the URI, then that will be a conflict under that definition, right? Because the default builder/options has a &apos;value&apos; for everything, no?&lt;/p&gt;

&lt;p&gt;The scenario is only that I&apos;m specifying an alternative set of default options, which are overwritten by any option specified on the URI.&lt;/p&gt;</comment>
                            <comment id="283641" author="jeff.yemin" created="Thu, 7 Mar 2013 19:47:40 +0000"  >&lt;p&gt;in your use case, are there actually conflicts between them?  Are you specifying anything on URI that is also in options?&lt;/p&gt;</comment>
                            <comment id="283606" author="john.morales@10gen.com" created="Thu, 7 Mar 2013 18:59:25 +0000"  >&lt;p&gt;I am in fact expecting the URI params to win. The thinking being that if the option&apos;s on the URI, then that&apos;s an explicit choice made by the client/user so it should be respected. It&apos;s only for options not explicitly specified that I&apos;d like this alternate set of default options to be used in lieu of driver defaults.&lt;/p&gt;

&lt;p&gt;Having options win is to say ignore/overwrite anything settings the user specified on the URI, which is not the case we&apos;re looking for, but I suppose could be useful generally?&lt;/p&gt;</comment>
                            <comment id="283583" author="jeff.yemin" created="Thu, 7 Mar 2013 18:30:00 +0000"  >&lt;p&gt;Do you care about conflicts between the URI and the options, and if so, who would you want to win?  With this approach the URI will win, which I think is backwards.  Another option is to provide a MongoClient constructor that takes both a URI and options, and merge the two, with options winning.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="67882">JAVA-784</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <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|hrmkgv:</customfieldvalue>

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