<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:55:47 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-1894] Can&apos;t find a codec for class [Ljava.lang.String;</title>
                <link>https://jira.mongodb.org/browse/JAVA-1894</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;Following the aggregation example &lt;br/&gt;
&lt;a href=&quot;http://docs.mongodb.org/getting-started/java/aggregation/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/getting-started/java/aggregation/&lt;/a&gt;&lt;br/&gt;
I have tried to make a similar operation on my set of documents.&lt;br/&gt;
The only difference is that I tried to use $in in the $match clause.&lt;br/&gt;
The same operation in the shell works&lt;br/&gt;
db.getCollection(&apos;test&apos;).aggregate([ {&quot;$match&quot;: {&quot;code&quot;:&lt;/p&gt;
{&quot;$in&quot;:[&quot;1111&quot;, &quot;2223344&quot;]}
&lt;p&gt;}}]);&lt;/p&gt;

&lt;p&gt;using the driver it looks like this&lt;br/&gt;
String[] codes = &lt;/p&gt;
{&quot;1112233&quot;, &quot;2223344&quot;}
&lt;p&gt;;&lt;br/&gt;
AggregateIterable&amp;lt;Document&amp;gt; iterable = db.getCollection(&quot;test&quot;).aggregate(asList(&lt;br/&gt;
                new Document(&quot;$match&quot;, new Document(&quot;code&quot;, new Document(&quot;$in&quot;, codes)))));&lt;/p&gt;

&lt;p&gt;however it fails with&lt;br/&gt;
Exception in thread &quot;main&quot; org.bson.codecs.configuration.CodecConfigurationException: Can&apos;t find a codec for class [Ljava.lang.String;.&lt;br/&gt;
	at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46)&lt;br/&gt;
	at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63)&lt;br/&gt;
	at org.bson.codecs.configuration.ChildCodecRegistry.get(ChildCodecRegistry.java:51)&lt;br/&gt;
	at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:174)&lt;br/&gt;
	at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189)&lt;br/&gt;
	at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172)&lt;br/&gt;
	at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189)&lt;br/&gt;
	at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172)&lt;br/&gt;
	at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189)&lt;br/&gt;
	at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:131)&lt;br/&gt;
	at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:45)&lt;br/&gt;
	at org.bson.BsonDocumentWrapper.getUnwrapped(BsonDocumentWrapper.java:189)&lt;br/&gt;
	at org.bson.BsonDocumentWrapper.get(BsonDocumentWrapper.java:129)&lt;br/&gt;
	at com.mongodb.AggregateIterableImpl.execute(AggregateIterableImpl.java:118)&lt;br/&gt;
	at com.mongodb.AggregateIterableImpl.forEach(AggregateIterableImpl.java:107)&lt;br/&gt;
	at AggregationTest.main(AggregationTest.java:27)&lt;/p&gt;</description>
                <environment>ubuntu x64, java 8</environment>
        <key id="217363">JAVA-1894</key>
            <summary>Can&apos;t find a codec for class [Ljava.lang.String;</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</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="-1">Unassigned</assignee>
                                    <reporter username="stas.smirnov">Stanislav</reporter>
                        <labels>
                    </labels>
                <created>Fri, 17 Jul 2015 09:31:40 +0000</created>
                <updated>Wed, 11 Sep 2019 19:10:19 +0000</updated>
                            <resolved>Thu, 24 Sep 2015 21:19:34 +0000</resolved>
                                    <version>3.0.2</version>
                                                    <component>Codecs</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="968715" author="jeff.yemin" created="Fri, 17 Jul 2015 13:23:33 +0000"  >&lt;p&gt;The Document class currently supports only List, not native Java array, so just replace with:&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;List&amp;lt;String&amp;gt; codes = Arrays.asList(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;1112233&quot;&lt;/span&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;, &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;2223344&quot;&lt;/span&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;);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
</comment>
                            <comment id="968642" author="stas.smirnov" created="Fri, 17 Jul 2015 10:00:02 +0000"  >&lt;p&gt;Well, looking in the source code I found a codec for the List.&lt;br/&gt;
If I switch from String[] to ArrayList&amp;lt;String&amp;gt; it works.&lt;br/&gt;
Do no know whether or not String[] is needed, so sorry for the noise if not. &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|hsb9i7:</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>