<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:39:23 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-2797] Treat named and anonymous private struct fields the same when marshaling</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2797</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;Currently the Go BSON library considers a private struct field one that both has a non-empty &lt;tt&gt;PkgPath&lt;/tt&gt; and is not anonymous (i.e. not embedded). For example:&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;   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;structField.PkgPath != &quot;&quot; &amp;amp;&amp;amp; !structField.Anonymous&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;However, that logic disagrees with the Go &lt;tt&gt;reflect&lt;/tt&gt; definition of a private struct field, which only considers &lt;tt&gt;PkgPath != &quot;&quot;&lt;/tt&gt;. As implemented in the &lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/blob/eb83f20dc02a797b03aa1b4b988f98dd4fb0bd9d/bson/bsoncodec/struct_codec.go#L463&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;StructCodec code&lt;/a&gt;, the difference only affects the behavior of the &lt;tt&gt;AllowUnexportedFields&lt;/tt&gt; option, but the result is that the &lt;tt&gt;AllowUnexportedFields&lt;/tt&gt; option only applies to anonymous fields in structs.&lt;/p&gt;

&lt;p&gt;That behavior seems to be inspired by similar logic in the &lt;a href=&quot;https://github.com/globalsign/mgo/blob/eeefdecb41b842af6dc652aaea4026e8403e62df/bson/bson.go#L725&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mgo BSON code&lt;/a&gt; which incorrectly considers all anonymous fields non-private.&lt;/p&gt;

&lt;p&gt;Definition of done:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Update the &lt;tt&gt;AllowUnexportedFields&lt;/tt&gt; option to consider &lt;em&gt;all&lt;/em&gt; private fields valid, not just anonymous ones.&lt;/li&gt;
	&lt;li&gt;Update the &lt;tt&gt;mgocompat&lt;/tt&gt; registry to use a struct encoder that doesn&apos;t rely on the &lt;tt&gt;AllowUnexportedFields&lt;/tt&gt; option.&lt;/li&gt;
&lt;/ul&gt;

</description>
                <environment></environment>
        <key id="2307018">GODRIVER-2797</key>
            <summary>Treat named and anonymous private struct fields the same when marshaling</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="matt.dale@mongodb.com">Matt Dale</reporter>
                        <labels>
                    </labels>
                <created>Wed, 5 Apr 2023 04:43:39 +0000</created>
                <updated>Wed, 30 Aug 2023 22:30:38 +0000</updated>
                            <resolved>Fri, 21 Apr 2023 00:12:37 +0000</resolved>
                                                                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="5364373" author="JIRAUSER1259527" created="Fri, 21 Apr 2023 00:12:37 +0000"  >&lt;p&gt;Recent versions of Go restrict access to read and set unexported struct fields,so we&apos;re dropping support for &lt;tt&gt;AllowUnexportedFields&lt;/tt&gt; in Go Driver 2.0. Closing this ticket.&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_14266" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Documentation Changes Summary</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;1.  What would you like to communicate to the user about this feature?&lt;br/&gt;
2.  Would you like the user to see examples of the syntax and/or executable code and its output?&lt;br/&gt;
3.  Which versions of the driver/connector does this apply to?&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i1lqgo:</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>