<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:10:25 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>[SERVER-5974] distinct returns duplicate values</title>
                <link>https://jira.mongodb.org/browse/SERVER-5974</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Here is dump of mongo shell.&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;some documents have &quot;jclient.targets_list&quot; == []&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;: {$exists: true}}).count()&lt;br/&gt;
578244&lt;/li&gt;
	&lt;li&gt;some documents have no &quot;jclient&quot; at all&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;: {$exists: false}}).count()&lt;br/&gt;
3943&lt;/li&gt;
	&lt;li&gt;it&apos;s indexed field&lt;br/&gt;
&amp;gt; db.mondata.getIndexKeys()&lt;br/&gt;
[&lt;br/&gt;
&lt;span class=&quot;error&quot;&gt;&amp;#91;skipped&amp;#93;&lt;/span&gt;
	{
		&quot;jclient.targets_list&quot; : 1
	}
&lt;p&gt;]&lt;/p&gt;&lt;/li&gt;
	&lt;li&gt;and.... here is &quot;distinct&quot;&lt;br/&gt;
&amp;gt; db.mondata.distinct(&quot;jclient.targets_list&quot;)&lt;br/&gt;
[ null, null ]&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;It really looks like bug.&lt;/p&gt;

&lt;p&gt;Here are some more strange samples:&lt;br/&gt;
&amp;gt; db.mondata.distinct(&quot;jclient.targets_list&quot;, {&quot;jclient.targets_list&quot;: {$exists: true}})&lt;br/&gt;
[ ]&lt;br/&gt;
&amp;gt; db.mondata.distinct(&quot;jclient.targets_list&quot;, {&quot;jclient.targets_list&quot;: {$exists: false}})&lt;br/&gt;
[ null ]&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;so [] + &lt;span class=&quot;error&quot;&gt;&amp;#91;null&amp;#93;&lt;/span&gt; should be &lt;span class=&quot;error&quot;&gt;&amp;#91;null&amp;#93;&lt;/span&gt;, should not it?&lt;br/&gt;
&amp;gt; db.mondata.distinct(&quot;jclient.targets_list&quot;, {$or: &lt;span class=&quot;error&quot;&gt;&amp;#91;{&amp;quot;jclient.targets_list&amp;quot;: {$exists: false}}, {&amp;quot;jclient.targets_list&amp;quot;: {$exists: true}}&amp;#93;&lt;/span&gt;})&lt;br/&gt;
[ ]&lt;/li&gt;
&lt;/ol&gt;
</description>
                <environment>FreeBSD 8.2, 64-bit</environment>
        <key id="40094">SERVER-5974</key>
            <summary>distinct returns duplicate values</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="3">Duplicate</resolution>
                                        <assignee username="siddharth.singh@10gen.com">siddharth.singh@10gen.com</assignee>
                                    <reporter username="darkk">Leonid Evdokimov</reporter>
                        <labels>
                    </labels>
                <created>Thu, 31 May 2012 16:27:33 +0000</created>
                <updated>Wed, 15 Aug 2012 14:04:17 +0000</updated>
                            <resolved>Fri, 15 Jun 2012 16:27:02 +0000</resolved>
                                    <version>2.0.2</version>
                                                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="133360" author="siddharth.singh@10gen.com" created="Fri, 15 Jun 2012 16:26:05 +0000"  >&lt;p&gt;Hi Leonid,&lt;/p&gt;

&lt;p&gt;  I am moving forward to closing this one. I created a separate &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6102&quot; title=&quot;Shell displays both &amp;#39;undefined&amp;#39; and &amp;#39;null&amp;#39; type as &amp;#39;null&amp;#39;&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6102&quot;&gt;&lt;del&gt;SERVER-6102&lt;/del&gt;&lt;/a&gt; to better represent the problem source and project tracking. Much thanks for reporting this to us. &lt;/p&gt;</comment>
                            <comment id="131294" author="siddharth.singh@10gen.com" created="Tue, 12 Jun 2012 21:12:21 +0000"  >&lt;p&gt;Hi Leonid,&lt;/p&gt;

&lt;p&gt;  I was able to reproduce and find the root cause of the issue. Please see the attached test script. When you see &lt;span class=&quot;error&quot;&gt;&amp;#91;null, null&amp;#93;&lt;/span&gt; it is the shell showing two different things as one and so  it is confusing. &lt;/p&gt;

&lt;p&gt;The shell displays both &apos;undefined&apos; type and &apos;null&apos; type as null. Internally the server does differentiate among them and identifies them as two different things. So what comes back from server is actually &lt;span class=&quot;error&quot;&gt;&amp;#91;undefined, null&amp;#93;&lt;/span&gt; which are distinct but shell shows them both as the same.&lt;/p&gt;

&lt;p&gt;Undefined vs Null  : Note that in the attached script there is an index on users.points. When you run a distinct on users.points, the command tries to be smart and tries to use the index.  The &apos;undefined&apos; values come from records entered on line 5 and 6 of the script, with an empty users.points (users.points = []). The &apos;null&apos; values come from records entered on line 9 and 10 of the script as they do not appear in the index.&lt;/p&gt;

&lt;p&gt;At the end, the distinct set looks like this &lt;span class=&quot;error&quot;&gt;&amp;#91;undefined, null, 1, 2&amp;#93;&lt;/span&gt; but appears as &lt;span class=&quot;error&quot;&gt;&amp;#91;null, null, 1, 2&amp;#93;&lt;/span&gt; in the mongo shell.&lt;/p&gt;</comment>
                            <comment id="125605" author="darkk" created="Mon, 4 Jun 2012 09:45:38 +0000"  >&lt;p&gt;Sure.&lt;/p&gt;

&lt;p&gt;&amp;gt; db.mondata.distinct(&quot;jclient.targets_list&quot;)&lt;br/&gt;
[ null, null ]&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;:{$type:10}}).count()&lt;br/&gt;
0&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;:{$type:6}}).count()&lt;br/&gt;
0&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;:{$type:4}}).count()&lt;br/&gt;
0&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;: {$exists: true}}).count()&lt;br/&gt;
501693&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;: {$exists: false}}).count()&lt;br/&gt;
149204&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;:{$type:2}}).count()&lt;br/&gt;
0&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;:{$type:3}}).count()&lt;br/&gt;
0&lt;br/&gt;
&amp;gt; db.mondata.find({&quot;jclient.targets_list&quot;:{$type:14}}).count()&lt;br/&gt;
0&lt;/p&gt;</comment>
                            <comment id="125554" author="scotthernandez" created="Sun, 3 Jun 2012 22:57:23 +0000"  >&lt;p&gt;Can you run these?&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;   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;&amp;gt;db.mondata.find({&quot;jclient.targets_list&quot;:{$type:10}}).count() // null type&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&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-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;&amp;gt;db.mondata.find({&quot;jclient.targets_list&quot;:{$type:6}}).count() // undefined type&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>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="41411">SERVER-6102</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="17152" name="5974.js" size="570" author="siddharth.singh@10gen.com" created="Tue, 12 Jun 2012 21:13:29 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sun, 3 Jun 2012 22:57:23 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 35 weeks, 5 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-6102'>SERVER-6102</a></s>]]></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_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ian@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 35 weeks, 5 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>darkk</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
            <customfieldvalue>siddharth.singh@10gen.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hro1dr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrir3b:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>23042</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|ht09y7:</customfieldvalue>

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