<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:58:51 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>[CXX-316] Handle MongoDB connection string format differently than legacy format</title>
                <link>https://jira.mongodb.org/browse/CXX-316</link>
                <project id="11980" key="CXX">C++ Driver</project>
                    <description>&lt;p&gt;ConnectionString::parse currently falls back to allowing an alternate internal mongodb connection format that can be parsed and considered valid by isValid() but do the wrong thing when connecting (which is surprising for the user).&lt;/p&gt;

&lt;p&gt;An example of this is the following url:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;localhost:1050,localhost:1055,localhost:1056/?replicaSet=rs-83d7523f-16cf-4246-8014-f1a6fa7ec264&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;It doesn&apos;t start with a &lt;tt&gt;mongodb://&lt;/tt&gt; so it&apos;s parsed in classic mode which creates the following observable behavior on the resulting connection string:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;isValid() returns true&lt;/li&gt;
	&lt;li&gt;getServers() returns: &lt;tt&gt;replicaSet=rs-83d7523f-16cf-4246-8014-f1a6fa7ec264:27017&lt;/tt&gt; which is essentially the replica set portion&lt;/li&gt;
	&lt;li&gt;getSetName returns: &quot;localhost:1050,localhost:1055,localhost:1056&quot; which is essentially the servers portion&lt;/li&gt;
	&lt;li&gt;connect() fails with: &quot;connect failed to replica set localhost:1050,localhost:1055,localhost:1056/?replicaSet=rs-83d7523f-16cf-4246-8014-f1a6fa7ec264:27017&quot;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;I am proposing that we split the functionality by having &lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;ConnectionString::parse accept only valid MongoDB connection strings&lt;/li&gt;
	&lt;li&gt;Another parsing function to handle the odd deprecated internal format&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;We can also probably throw if there is no match in the new function now that we don&apos;t support the older version of the api.&lt;/p&gt;</description>
                <environment>All</environment>
        <key id="154810">CXX-316</key>
            <summary>Handle MongoDB connection string format differently than legacy format</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="9">Done</resolution>
                                        <assignee username="samantha.ritter@mongodb.com">Samantha Ritter</assignee>
                                    <reporter username="tyler@10gen.com">Tyler Brock</reporter>
                        <labels>
                            <label>legacy-cxx</label>
                    </labels>
                <created>Tue, 26 Aug 2014 15:38:23 +0000</created>
                <updated>Thu, 23 Oct 2014 18:31:30 +0000</updated>
                            <resolved>Tue, 7 Oct 2014 15:46:42 +0000</resolved>
                                    <version>legacy-1.0.0-rc0</version>
                                    <fixVersion>legacy-1.0.0-rc1</fixVersion>
                                    <component>API</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="735613" author="xgen-internal-githook" created="Tue, 7 Oct 2014 15:46:18 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;samantharitter&apos;, u&apos;name&apos;: u&apos;Samantha Ritter&apos;, u&apos;email&apos;: u&apos;samantha.ritter@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-316&quot; title=&quot;Handle MongoDB connection string format differently than legacy format&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-316&quot;&gt;&lt;del&gt;CXX-316&lt;/del&gt;&lt;/a&gt; Update Connection String URI Parsing&lt;br/&gt;
Branch: legacy&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-cxx-driver/commit/e3a7573fa73b6fa5c380827b8a5580a6eb5466f0&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-cxx-driver/commit/e3a7573fa73b6fa5c380827b8a5580a6eb5466f0&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="716213" author="samantha.ritter@10gen.com" created="Wed, 10 Sep 2014 21:05:33 +0000"  >&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-cxx-driver/pull/140&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-cxx-driver/pull/140&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="705597" author="tyler@10gen.com" created="Wed, 27 Aug 2014 14:39:39 +0000"  >&lt;p&gt;Hey Samantha. Failure is expected but not encountered, which is why this needs to change.&lt;/p&gt;

&lt;p&gt;The code works because it finds a slash in the MongoDB URI. However, the parameters to ConnectionString are flipped. In the proprietary format the set name is on the left and servers on the right, the MongoConnection string has the servers on the left and the params (like set name) on the right so it winds up building a connection string with {{ (?ReplicaSet=XXX)}} as the servers and the server list (&lt;tt&gt;member1:port,member2:port...&lt;/tt&gt;) as the replica set name (when its the list if servers):&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;string::size_type i = url.find( &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;&apos;/&apos;&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; );&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;   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;        &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;if&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; ( i != string::npos &amp;amp;&amp;amp; i != 0) {&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;   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;            &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;// replica set&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;   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;            &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;return&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; ConnectionString( SET , url.substr( i + 1 ) , url.substr( 0 , i ) );&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;        }&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;The result is that it appears to work (isValid() returns true) but it builds a connection string with the wrong information and can&apos;t connect.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="157536">CXX-336</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </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|hs1ouf:</customfieldvalue>

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