<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:57:48 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-2672] collection.distinct().batchCursor() does not decode results</title>
                <link>https://jira.mongodb.org/browse/JAVA-2672</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;I&apos;m using the following code to get distinct values of a specific type asynchronously:&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;collection.distinct(&quot;fieldName&quot;, SomeType.class).batchCursor(&#8230;)&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;The problem is that even though the result is declared as &lt;tt&gt;AsyncBatchCursor&amp;lt;SomeType&amp;gt;&lt;/tt&gt; the actual values are of type &lt;tt&gt;String&lt;/tt&gt; because the respective codec was never applied.&lt;/p&gt;

&lt;p&gt;After debugging a lot I&apos;ve figured out that &lt;tt&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/3e323b5fdc086794aa290e50ed1bae8f3b4618b7/driver-core/src/main/com/mongodb/operation/DistinctOperation.java#L243&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;DistinctOperation.asyncTransformer()&lt;/a&gt;&lt;/tt&gt; doesn&apos;t use the supplied &lt;tt&gt;decoder&lt;/tt&gt; at all.&lt;/p&gt;</description>
                <environment></environment>
        <key id="461854">JAVA-2672</key>
            <summary>collection.distinct().batchCursor() does not decode results</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="-1">Unassigned</assignee>
                                    <reporter username="fluidsonic">Marc Knaup</reporter>
                        <labels>
                    </labels>
                <created>Mon, 20 Nov 2017 21:37:17 +0000</created>
                <updated>Fri, 27 Oct 2023 13:21:10 +0000</updated>
                            <resolved>Tue, 21 Nov 2017 21:13:27 +0000</resolved>
                                    <version>3.5.0</version>
                                                    <component>Command Operations</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1732191" author="jeff.yemin" created="Tue, 21 Nov 2017 21:13:27 +0000"  >&lt;p&gt;No worries.  Closing.&lt;/p&gt;</comment>
                            <comment id="1732099" author="fluidsonic" created="Tue, 21 Nov 2017 20:06:03 +0000"  >&lt;p&gt;I&apos;ve found the root cause of the issue outside of the Java driver so this issue can be closed.&lt;br/&gt;
I&apos;m really sorry for wasting your time here. &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/sad.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="1731097" author="jeff.yemin" created="Mon, 20 Nov 2017 22:34:29 +0000"  >&lt;p&gt;There&apos;s &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/r3.5.0/driver-core/src/test/functional/com/mongodb/operation/DistinctOperationSpecification.groovy#L125-L153&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;a test&lt;/a&gt; that demonstrates that it works as specified.&lt;/p&gt;

&lt;p&gt;DistinctOperation doesn&apos;t use the supplied decoder directly, instead &lt;a href=&quot;https://github.com/mongodb/mongo-java-driver/blob/r3.5.0/driver-core/src/main/com/mongodb/operation/DistinctOperation.java#L223&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;delegating&lt;/a&gt; to &lt;tt&gt;com.mongodb.operation.CommandResultDocumentCodec&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Can you provide a small test program that reproduces the problem?&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|htc6cf:</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>