<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:35:50 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-1175] allow BSON null values to decode into non-nilable Go types</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-1175</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;purpose:&#160; fix `can not decode null into a xxx type` issues.&lt;/p&gt;

&lt;p&gt;current possible solution:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;change data in mongodb&lt;/li&gt;
	&lt;li&gt;use pointer type, e.g. define field as type `*string`&#160; but not&#160; `string`&lt;/li&gt;
	&lt;li&gt;customize the bson decoder&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;solution 1 is very difficult to do if considering team cooperation.&lt;/p&gt;

&lt;p&gt;solution 3 is too heavy for such small requirement.&lt;/p&gt;

&lt;p&gt;solution 2 is most acceptable so far, but it will make code ugly, because the compromise between field type and decoder&lt;/p&gt;

&lt;p&gt;i propose a new tag property:&lt;/p&gt;

&lt;p&gt;`skipnull`: skip null value(don&apos;t touch this field, or set to zero value?) when unmarshaling&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;this propose&#160;assume that in many cases, null value and non-exist is the same thing in mongodb. feel free to close this issue if the assumption don&apos;t make much sense&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;EDIT: We&apos;ve gotten multiple requests to allow BSON null values to decode into Go types that can&apos;t necessarily be nil (e.g. string). We should change our default decoders to accept BSON null values so there&apos;s no user configuration required to enable this feature. I&apos;m adding this to the mgo BSON registry epic to help us track the ticket, but it will be enabled as a default for all codecs, not just in the mgo registry.&lt;/p&gt;</description>
                <environment></environment>
        <key id="828904">GODRIVER-1175</key>
            <summary>allow BSON null values to decode into non-nilable Go types</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="13201">Fixed</resolution>
                                        <assignee username="divjot.arora@mongodb.com">Divjot Arora</assignee>
                                    <reporter username="zzn">zzn</reporter>
                        <labels>
                            <label>mgocompat</label>
                    </labels>
                <created>Mon, 1 Jul 2019 02:59:53 +0000</created>
                <updated>Sat, 28 Oct 2023 11:38:43 +0000</updated>
                            <resolved>Thu, 30 Jan 2020 14:22:46 +0000</resolved>
                                                    <fixVersion>1.3.0</fixVersion>
                                    <component>BSON</component>
                                        <votes>4</votes>
                                    <watches>9</watches>
                                                                                                                <comments>
                            <comment id="2772709" author="xgen-internal-githook" created="Thu, 30 Jan 2020 14:22:35 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Divjot Arora&apos;, &apos;username&apos;: &apos;divjotarora&apos;, &apos;email&apos;: &apos;divjot.arora@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-1175&quot; title=&quot;allow BSON null values to decode into non-nilable Go types&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-1175&quot;&gt;&lt;del&gt;GODRIVER-1175&lt;/del&gt;&lt;/a&gt; Allow BSON values to decode into non-nilable Go types (#277)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/e7e0dae2288928068a092ae0ab150940753733ba&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/e7e0dae2288928068a092ae0ab150940753733ba&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="2385637" author="mwei" created="Mon, 26 Aug 2019 02:19:09 +0000"  >&lt;p&gt;Few other suggestions to achieve similar results:&lt;/p&gt;

&lt;p&gt;1. Define an &lt;em&gt;Niler&lt;/em&gt; interface (like &lt;a href=&quot;https://godoc.org/go.mongodb.org/mongo-driver/bson#Zeroer&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;em&gt;Zeroer&lt;/em&gt;&lt;/a&gt; but for unmarshaling).&lt;/p&gt;

&lt;p&gt;2. (&lt;a href=&quot;https://godoc.org/labix.org/v2/mgo/bson#SetZero&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;mgo&lt;/a&gt;) Define an error &lt;em&gt;SetZero&lt;/em&gt; to let decoder set to zero or nil pointer when the error is returned.&lt;/p&gt;

&lt;p&gt;Currently other than having custom decoder I cannot set nil pointer when unmarshaling.&#160; I am looking forward to this change as well.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5002K00000f1R7aQAE]]]></customfieldvalue>

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