<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:57:07 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>[JAVA-2404] Cannot use BasicDBList as value with Updates builder methods</title>
                <link>https://jira.mongodb.org/browse/JAVA-2404</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>
&lt;p&gt;If you use the Updates class in this  way  Updates.set(&quot;array&quot;, value) where value is a BasicDbList Object the result of the insert is&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
    &quot;_id&quot; : &quot;ID&quot;,&lt;br/&gt;
    &quot;array&quot; : &lt;/p&gt;
{
        &quot;0&quot; : 100,
        &quot;1&quot; : 200,
        &quot;2&quot; : 400
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;The list BasicDBList is now a document instead of a list&lt;/p&gt;</description>
                <environment></environment>
        <key id="337586">JAVA-2404</key>
            <summary>Cannot use BasicDBList as value with Updates builder methods</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="giordanomaestro">Giordano Maestro</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Dec 2016 11:22:00 +0000</created>
                <updated>Mon, 9 Jan 2017 21:08:31 +0000</updated>
                            <resolved>Mon, 9 Jan 2017 21:08:31 +0000</resolved>
                                    <version>3.0.0</version>
                                    <fixVersion>3.5.0</fixVersion>
                                    <component>Codecs</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1472995" author="xgen-internal-githook" created="Mon, 9 Jan 2017 21:08:03 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;jyemin&apos;, u&apos;name&apos;: u&apos;Jeff Yemin&apos;, u&apos;email&apos;: u&apos;jeff.yemin@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/JAVA-2404&quot; title=&quot;Cannot use BasicDBList as value with Updates builder methods&quot; class=&quot;issue-link&quot; data-issue-key=&quot;JAVA-2404&quot;&gt;&lt;del&gt;JAVA-2404&lt;/del&gt;&lt;/a&gt;: Prevent DBObjectCodecProvider from providing a Codec for a DBObject that is also a List.&lt;/p&gt;

&lt;p&gt;   Othewise, it will provide the DBObjectCodec for BasicDBList which is incorrect.  With this change,&lt;br/&gt;
   the IterableCodecProvider will end up providing ListCodec, which is the correct thing to do.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/commit/f10bebf2db5b2c9feb8adc24718a4e836c37950e&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-java-driver/commit/f10bebf2db5b2c9feb8adc24718a4e836c37950e&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1453731" author="ross@10gen.com" created="Fri, 9 Dec 2016 11:50:49 +0000"  >&lt;p&gt;Hi Giordano Maestro,&lt;/p&gt;

&lt;p&gt;Thanks for the ticket, this is an interesting corner case and essentially is a configuration issue with the codec registry.  &lt;/p&gt;

&lt;p&gt;The &lt;tt&gt;BasicDbList&lt;/tt&gt; is a subclass of &lt;tt&gt;DBObject&lt;/tt&gt; due to the class reflecting the way BSON lists work. When the &lt;tt&gt;Updates.set&lt;/tt&gt; helper looks up the class for the value in the &lt;tt&gt;CodecRegistry&lt;/tt&gt; its returned a &lt;tt&gt;DBObjectCodec&lt;/tt&gt; as its seeing a &lt;tt&gt;DBObject&lt;/tt&gt; class and treating it as such.&lt;/p&gt;

&lt;p&gt;There are a couple of work arounds, one would be to add a specific codec to handle BasicDBLists, or a simpler way would be to explicitly convert the  &lt;tt&gt;BasicDbList&lt;/tt&gt;  to a List eg:&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;Updates.set(&quot;array&quot;,  Arrays.asList(value.toArray()))&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;Ross&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="145676" name="test-case-bug.zip" size="1923" author="giordanomaestro" created="Fri, 9 Dec 2016 11:21:36 +0000"/>
                    </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|hssw9b:</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>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1409">JVM Sprint 37</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>