<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:38:06 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>[GODRIVER-2226] Build a Connection String programmatically from connstring.ConnString</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2226</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;We would like to be able to programmatically create a Connection String from a struct like &lt;tt&gt;connstring.ConnString&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Ideally we could use a builder pattern in order to do:&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;builder := connstring.Builder().&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;    SetScheme(MongoDBSRV).&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;    SetHosts([]string{&quot;host:27017&quot;}).&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;    SetTLS(true).&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;    SetUsername(&quot;user&quot;)&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;&amp;nbsp;&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;assert.Equal(t,  &quot;mongodb+srv://user@host:27017?ssl=true&quot;, builder.Build().ToURI())&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;In the previous example, &lt;tt&gt;builder.Build()&lt;/tt&gt; would return a concrete &lt;tt&gt;ConnString&lt;/tt&gt; that can be called with &lt;tt&gt;ToURI()&lt;/tt&gt; to obtain a valid connection string.&lt;/p&gt;

&lt;p&gt;The builder part is just an example, a ConnString object with a function like &lt;tt&gt;ToURI()&lt;/tt&gt; or &lt;tt&gt;ToString()&lt;/tt&gt; is what we really need. How that &lt;tt&gt;ConnString&lt;/tt&gt; is constructed can be done on our side.&lt;/p&gt;

&lt;p&gt;Our particular use case (Kubernetes Operators) is that we create Connection Strings in &lt;tt&gt;Secret&lt;/tt&gt; Kubernetes objects that users could mount into their client applications. Currently we do this with a series of error-prone &lt;tt&gt;fmt.Sprintf()&lt;/tt&gt; function calls.&lt;/p&gt;

&lt;p&gt;We have two examples in Community Operator using &lt;tt&gt;fmt.Sprintf()&lt;/tt&gt; to build connection strings:&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongodb-kubernetes-operator/blob/cd411b999c4d737644b5e5f9ee21ccaa0498c901/api/v1/mongodbcommunity_types.go#L505&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongodb-kubernetes-operator/blob/cd411b999c4d737644b5e5f9ee21ccaa0498c901/api/v1/mongodbcommunity_types.go#L505&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/mongodb/mongodb-kubernetes-operator/blob/cd411b999c4d737644b5e5f9ee21ccaa0498c901/api/v1/mongodbcommunity_types.go#L510&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongodb-kubernetes-operator/blob/cd411b999c4d737644b5e5f9ee21ccaa0498c901/api/v1/mongodbcommunity_types.go#L510&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;And there are more in Enterprise and Atlas Operators as well.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1924158">GODRIVER-2226</key>
            <summary>Build a Connection String programmatically from connstring.ConnString</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="10300" iconUrl="https://jira.mongodb.org/images/icons/priorities/medium.svg">Unknown</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="12300">Won&apos;t Do</resolution>
                                        <assignee username="matt.dale@mongodb.com">Matt Dale</assignee>
                                    <reporter username="rodrigo.valin@mongodb.com">Rodrigo Valin</reporter>
                        <labels>
                    </labels>
                <created>Fri, 12 Nov 2021 17:20:45 +0000</created>
                <updated>Tue, 29 Nov 2022 06:34:31 +0000</updated>
                            <resolved>Tue, 29 Nov 2022 02:19:33 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="5013911" author="JIRAUSER1257138" created="Tue, 29 Nov 2022 06:34:31 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=matt.dale%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;matt.dale@mongodb.com&quot;&gt;matt.dale@mongodb.com&lt;/a&gt; , makes sense and thanks for the detailed explanation.&#160;&lt;/p&gt;</comment>
                            <comment id="5013597" author="JIRAUSER1259527" created="Tue, 29 Nov 2022 02:19:33 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=rajdeep.das%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;rajdeep.das@mongodb.com&quot;&gt;rajdeep.das@mongodb.com&lt;/a&gt;, after considering this more, I don&apos;t think the Go driver is the right place to add this functionality. The MongoDB connection string format is based on a &lt;a href=&quot;https://www.mongodb.com/docs/manual/reference/connection-string/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;specification&lt;/a&gt; that all drivers, including the Go driver, implement parsers for. Because the Go driver is not the de-facto standard for the MongoDB connection string format, a connection string builder implemented in the Go driver will not be any more correct than one implemented totally independently of the Go driver (e.g. separate repository, no Go driver dependency). I&apos;m also concerned that a connection string builder implemented in the Go driver would be overly generic and difficult to maintain because the Go driver has no implicit need for it. A more purpose-specific connection string builder would be easier to implement and maintain in a repository that directly depends on it (or a separate repository if necessary to share it between projects).&lt;/p&gt;

&lt;p&gt;As far as the &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/0e5ae89f1baf3d6edca093467ffd1f870b441add/x/mongo/driver/connstring/connstring.go#L56&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;connstring.ConnString&lt;/tt&gt;&lt;/a&gt; struct in the Go driver, it is only intended to provide the information necessary for the Go driver to connect to a MongoDB deployment, but can not represent every valid MongoDB connection string. For example, the Go driver does not support the &lt;tt&gt;tlsAllowInvalidCertificates&lt;/tt&gt;, &lt;tt&gt;tlsAllowInvalidHostnames&lt;/tt&gt;, &lt;tt&gt;waitQueueMultiple&lt;/tt&gt;, or &lt;tt&gt;waitQueueTimeoutMS&lt;/tt&gt; connection string options, so the &lt;tt&gt;connstring.ConnString&lt;/tt&gt; struct has no corresponding fields for those. It could be a good starting point for a MongoDB connection string builder, but it&apos;s not currently intended for that purpose.&lt;/p&gt;

&lt;p&gt;TLDR: A MongoDB connection string builder doesn&apos;t need to be implemented in the Go driver to be correct. Implementing a connection string builder may actually be easier where it will be used than in the Go driver, which has no use case for it.&lt;/p&gt;</comment>
                            <comment id="5007233" author="JIRAUSER1257138" created="Fri, 25 Nov 2022 06:11:22 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=matt.dale%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;matt.dale@mongodb.com&quot;&gt;matt.dale@mongodb.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are wondering if there is any update on this ticket?&lt;/p&gt;</comment>
                            <comment id="4191429" author="rodrigo.valin" created="Tue, 16 Nov 2021 12:01:03 +0000"  >&lt;p&gt;We need specifically to build a connection string.&lt;/p&gt;

&lt;p&gt;Take as an example the following &lt;tt&gt;Build&lt;/tt&gt; function:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;a href=&quot;https://github.com/10gen/ops-manager-kubernetes/blob/CLOUDP-105205_create_standard_secret/controllers/operator/connectionstring/connectionstring.go#L125&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/10gen/ops-manager-kubernetes/blob/CLOUDP-105205_create_standard_secret/controllers/operator/connectionstring/connectionstring.go#L125&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;This function was built by us, but it is pretty rough around the edges; and I think we (and others) can benefit from a function provided by the go-driver. We would use this functionality in 3 Operators: Enterprise, Atlas and Community.&lt;/p&gt;</comment>
                            <comment id="4190425" author="JIRAUSER1259527" created="Mon, 15 Nov 2021 22:21:06 +0000"  >&lt;p&gt;Is the goal to generate a connection string programatically or to configure a client programatically? My understanding is that &lt;em&gt;most&lt;/em&gt; values that can be configured via a connection string can be configured by passing a &lt;tt&gt;ClientOptions&lt;/tt&gt; option, but that there are some missing configurations that can only be applied using &lt;tt&gt;mongodb+srv&lt;/tt&gt; protocol URIs.&lt;/p&gt;

&lt;p&gt;Would adding the missing &lt;tt&gt;ClientOptions&lt;/tt&gt; configuration values support the use case for the &lt;tt&gt;mongodb-kubernetes-operator&lt;/tt&gt;, or do you specifically need to programatically build a connection string (e.g. to be passed to some other process)?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                                                <inwardlinks description="is depended on by">
                                                        </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="549367">GODRIVER-428</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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>GODRIVER-1588</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_21553" key="com.atlassian.jira.plugin.system.customfieldtypes:labels">
                        <customfieldname>Quarter</customfieldname>
                        <customfieldvalues>
                                        <label>FY23Q3</label>
    
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr6jqv:whzo</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>