<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:39:36 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-2896] empty bson.RawValue marshal unmarshal behavior are inconsistent. unmarshal error</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-2896</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;when i read a mongo struct from mongodb, then process some filed, marshal to bytes, then store to cache.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;when&#160; other scenes, get bytes from cache, then unmarshal it , it is not work.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;like this:&lt;/em&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;unmarshal error document is invalid, end byte is at 28, but null byte found at 21&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;Pleaseprovidetheversionofthedriver.Ifapplicable%2CpleaseprovidetheMongoDBserverversionandtopology%28standalone%2Creplicaset%2Corshardedcluster%29.&quot;&gt;&lt;/a&gt;Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;the latest&lt;/em&gt;&#160; version&#160; v1.12.0 still has the same bug&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;HowtoReproduce&quot;&gt;&lt;/a&gt;How to Reproduce&lt;/h4&gt;
&lt;p&gt;type P struct &lt;/p&gt;
{
&#160; Name string `bson:&quot;name,omitempty&quot;`
&#160; Likes bson.RawValue `bson:&quot;likes,omitempty&quot;`
}

&lt;p&gt;func TestMismatch(t *testing.T) &lt;/p&gt;
{
&#160; bytes, err := bson.Marshal(&amp;amp;P\{Name: &quot;lilei&quot;}
&lt;p&gt;)&lt;br/&gt;
&#160; if err != nil &lt;/p&gt;
{
&#160; &#160; &#160; t.Fatalf(&quot;marshal error %s&quot;, err)
&#160; }
&lt;p&gt;&#160; var p P&lt;br/&gt;
&#160; err = bson.Unmarshal(bytes, &amp;amp;p)&lt;br/&gt;
&#160; if err != nil &lt;/p&gt;
{
&#160; &#160; &#160;t.Fatalf(&quot;unmarshal error %s&quot;, err)
&#160; }
&lt;p&gt;}&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;AdditionalBackground&quot;&gt;&lt;/a&gt;Additional Background&lt;/h4&gt;</description>
                <environment></environment>
        <key id="2388263">GODRIVER-2896</key>
            <summary>empty bson.RawValue marshal unmarshal behavior are inconsistent. unmarshal error</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="preston.vasquez@mongodb.com">Preston Vasquez</assignee>
                                    <reporter username="1124210681@qq.com">mongo mongo</reporter>
                        <labels>
                    </labels>
                <created>Tue, 11 Jul 2023 05:17:14 +0000</created>
                <updated>Sat, 28 Oct 2023 11:37:14 +0000</updated>
                            <resolved>Fri, 28 Jul 2023 16:51:13 +0000</resolved>
                                                    <fixVersion>1.12.1</fixVersion>
                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="5605492" author="xgen-internal-githook" created="Tue, 1 Aug 2023 17:15:41 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Preston Vasquez&apos;, &apos;email&apos;: &apos;prestonvasquez@icloud.com&apos;, &apos;username&apos;: &apos;prestonvasquez&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2896&quot; title=&quot;empty bson.RawValue marshal unmarshal behavior are inconsistent. unmarshal error&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2896&quot;&gt;&lt;del&gt;GODRIVER-2896&lt;/del&gt;&lt;/a&gt; Add IsZero to BSON RawValue (#1332)&lt;/p&gt;

&lt;p&gt;Co-authored-by: Matt Dale &amp;lt;9760375+matthewdale@users.noreply.github.com&amp;gt;&lt;br/&gt;
Branch: release/1.12&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/6c3474948935af10dc57388763d12de6837f1e3a&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/6c3474948935af10dc57388763d12de6837f1e3a&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5598986" author="xgen-internal-githook" created="Fri, 28 Jul 2023 16:50:07 +0000"  >&lt;p&gt;Author: &lt;/p&gt;
{&apos;name&apos;: &apos;Preston Vasquez&apos;, &apos;email&apos;: &apos;prestonvasquez@icloud.com&apos;, &apos;username&apos;: &apos;prestonvasquez&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/GODRIVER-2896&quot; title=&quot;empty bson.RawValue marshal unmarshal behavior are inconsistent. unmarshal error&quot; class=&quot;issue-link&quot; data-issue-key=&quot;GODRIVER-2896&quot;&gt;&lt;del&gt;GODRIVER-2896&lt;/del&gt;&lt;/a&gt; Add IsZero to BSON RawValue (#1332)&lt;/p&gt;

&lt;p&gt;Co-authored-by: Matt Dale &amp;lt;9760375+matthewdale@users.noreply.github.com&amp;gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-go-driver/commit/215d683afcf2d95b8414f46f82f6a8e7dac688b1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-go-driver/commit/215d683afcf2d95b8414f46f82f6a8e7dac688b1&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="5556427" author="JIRAUSER1274387" created="Tue, 11 Jul 2023 05:24:01 +0000"  >&lt;p&gt;sorry for&#160; not familiar with the Jira editor, some mistake after i paste the code here.&lt;/p&gt;

&lt;p&gt;I look into the mongo go driver, it may be the bug of&#160; RawValueEncodeValue.&#160;&lt;/p&gt;

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

&lt;p&gt;When marshalling, an empty RawValue was encoded with type 0 and the filed&#8216;s name written into the bytes, followed by the normal encoding of other fields.&lt;/p&gt;

&lt;p&gt;During decoding, when encountering a type of 0, it is assumed to be a null terminator and no further fields should exist. However, since the name and additional fields were added during encoding, causing a mismatch in length, an error occurred.&lt;/p&gt;</comment>
                            <comment id="5556426" author="dbeng-pm-bot" created="Tue, 11 Jul 2023 05:17:18 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=1124210681%40qq.com&quot; class=&quot;user-hover&quot; rel=&quot;1124210681@qq.com&quot;&gt;1124210681@qq.com&lt;/a&gt;, thank you for reporting this issue! The team will look into it and get back to you soon. &lt;/p&gt;</comment>
                    </comments>
                    <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_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10257" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Documentation Changes</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11861"><![CDATA[Not Needed]]></customfieldvalue>

                        </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|i1zg8g:</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>