<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:57:24 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-2513] org.bson.codecs.configuration.CodecConfigurationException in when update document with specified array field</title>
                <link>https://jira.mongodb.org/browse/JAVA-2513</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;i want to update userinfo.languages filled in this document.&lt;br/&gt;
{&quot;userInfo&quot;: {&lt;br/&gt;
			&quot;fullName&quot;: &quot;Ehsan Farahani Asil&quot;,&lt;br/&gt;
			&quot;birthdate&quot;: 0,&lt;br/&gt;
			&quot;aboutme&quot;: &quot;Nothing&quot;,&lt;br/&gt;
			&quot;interests&quot;: [],&lt;br/&gt;
			&quot;drinking&quot;: &quot;&quot;,&lt;br/&gt;
			&quot;smoking&quot;: &quot;&quot;,&lt;br/&gt;
			&quot;languages&quot;: [&lt;br/&gt;
				&lt;/p&gt;
{
					&quot;name&quot;: &quot;English&quot;,
					&quot;level&quot;: &quot;Native&quot;
				}
&lt;p&gt;,&lt;/p&gt;
				{
					&quot;name&quot;: &quot;Persian&quot;,
					&quot;level&quot;: &quot;Native&quot;
				}
&lt;p&gt;			],&lt;br/&gt;
			&quot;relationship&quot;: &quot;&quot;,&lt;br/&gt;
			&quot;sexuality&quot;: &quot;&quot;,&lt;br/&gt;
			&quot;bodyType&quot;: &quot;&quot;,&lt;br/&gt;
			&quot;eyeColor&quot;: &quot;&quot;,&lt;br/&gt;
			&quot;hairColor&quot;: &quot;Black&quot;,&lt;br/&gt;
			&quot;living&quot;: &quot;&quot;,&lt;br/&gt;
			&quot;kids&quot;: &quot;No&quot;,&lt;br/&gt;
			&quot;height&quot;: 0,&lt;br/&gt;
			&quot;weight&quot;: 0,&lt;br/&gt;
			&quot;work&quot;: &quot;Software Developer&quot;&lt;br/&gt;
		}&lt;br/&gt;
}&lt;br/&gt;
when i want to update this document with this code, mongodob java driver return error org.bson.codecs.configuration.CodecConfigurationException: Can&apos;t find a codec for class project.models.base.Language.&lt;/p&gt;

&lt;p&gt;i use this code for update &lt;br/&gt;
UpdateResult updateResult = mongoCollection.updateOne(eq(&quot;_id&quot;, new ObjectId(usersId)), Updates.set(&quot;userInfo.languages&quot;,userInfo.getLanguages()));&lt;/p&gt;

&lt;p&gt;public class UserInfo {&lt;br/&gt;
    private List&amp;lt;Language&amp;gt; languages = null;&lt;br/&gt;
 public List&amp;lt;Language&amp;gt; getLanguages() &lt;/p&gt;
{
        return languages;
    }

&lt;p&gt;    public void setLanguages(List&amp;lt;Language&amp;gt; languages) &lt;/p&gt;
{
        this.languages = languages;
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;public class Language  {&lt;br/&gt;
    @SerializedName(&quot;name&quot;)&lt;br/&gt;
    private String name;&lt;br/&gt;
    @SerializedName(&quot;level&quot;)&lt;br/&gt;
    private String level;&lt;/p&gt;

&lt;p&gt;    public String getName() &lt;/p&gt;
{
        return name;
    }

&lt;p&gt;    public void setName(String name) &lt;/p&gt;
{
        this.name = name;
    }

&lt;p&gt;    public String getLevel() &lt;/p&gt;
{
        return level;
    }

&lt;p&gt;    public void setLevel(String level) &lt;/p&gt;
{
        this.level = level;
    }
&lt;p&gt;}&lt;/p&gt;


&lt;p&gt;i problem with update each field that like languages use list&amp;lt;&amp;gt; or arrayList. in other filed that use integer, Boolean, string, double i don&apos;t have any problems.&lt;/p&gt;

&lt;p&gt;Best Regards&lt;br/&gt;
Ehsan Farahani Asil&lt;/p&gt;</description>
                <environment></environment>
        <key id="381840">JAVA-2513</key>
            <summary>org.bson.codecs.configuration.CodecConfigurationException in when update document with specified array field</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13202">Works as Designed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="ehsansis0">Ehsan Farahani Asil</reporter>
                        <labels>
                    </labels>
                <created>Mon, 8 May 2017 09:47:40 +0000</created>
                <updated>Fri, 27 Oct 2023 13:21:13 +0000</updated>
                            <resolved>Thu, 22 Jun 2017 16:46:59 +0000</resolved>
                                    <version>3.4.2</version>
                                                    <component>BSON</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1567544" author="ehsansis0" created="Tue, 9 May 2017 07:35:20 +0000"  >&lt;p&gt;thanks very much. i solve this problem with this action. first get document and then updated specified changed field.&lt;/p&gt;

&lt;p&gt;Best Regards&lt;br/&gt;
Ehsan Farahani Asil&lt;/p&gt;</comment>
                            <comment id="1566871" author="ross@10gen.com" created="Mon, 8 May 2017 15:32:33 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ehsansis0&quot; class=&quot;user-hover&quot; rel=&quot;ehsansis0&quot;&gt;ehsansis0&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;The error is because the Mongo Java Driver doesn&apos;t have a Codec for the Language object and therefore doesn&apos;t know how to convert it into BSON. The next release (3.5) will provide a POJO Codec which will allow you to easily register POJO&apos;s instances into the Codec Registry.  Until then you either must handwrite a Codec or convert to a Document manually and then update with that object.&lt;/p&gt;

&lt;p&gt;I hope that helps,&lt;/p&gt;

&lt;p&gt;Ross&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_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hszbt3:</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>