<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:59:22 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-2239] indexes causing non-distinct results in $or query</title>
                <link>https://jira.mongodb.org/browse/SERVER-2239</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I&apos;m not sure how to describe this.  So I made a gist.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://gist.github.com/743921&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://gist.github.com/743921&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If I run the query in question with only one object in the collection I get back two copies of the object.&lt;/p&gt;

&lt;p&gt;Indexes&lt;br/&gt;
======&lt;br/&gt;
&amp;gt; db.system.indexes.find()&lt;br/&gt;
{ &quot;name&quot; : &quot;&lt;em&gt;id&lt;/em&gt;&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;_id&quot; : 1 }
&lt;p&gt; }&lt;br/&gt;
{ &quot;name&quot; : &quot;email_1_encrypted_password_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;email&quot; : 1, &quot;encrypted_password&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : true }&lt;br/&gt;
{ &quot;name&quot; : &quot;memberships_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;memberships&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : false }&lt;br/&gt;
{ &quot;name&quot; : &quot;acl_fields.public_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;acl_fields.public&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : false }&lt;br/&gt;
{ &quot;name&quot; : &quot;acl_fields.value_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;acl_fields.value&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : false }&lt;br/&gt;
{ &quot;name&quot; : &quot;acl_fields.circles_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;acl_fields.circles&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : false }&lt;/p&gt;

&lt;p&gt;Object&lt;br/&gt;
=====&lt;br/&gt;
db.users.findOne()&lt;br/&gt;
{&lt;br/&gt;
	&quot;_id&quot; : ObjectId(&quot;4d0a54246a931656bc000006&quot;),&lt;br/&gt;
	&quot;acl_fields&quot; : [&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;first_name&quot;,
			&quot;public&quot; : false,
			&quot;value&quot; : &quot;Amos&quot;,
			&quot;_id&quot; : ObjectId(&quot;4d0a54246a931656bc000005&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclFirstName&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;email&quot;,
			&quot;public&quot; : false,
			&quot;value&quot; : &quot;amos@amos.com&quot;,
			&quot;_id&quot; : ObjectId(&quot;4d0a54246a931656bc000007&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclEmail&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;nickname&quot;,
			&quot;public&quot; : true,
			&quot;value&quot; : &quot;aking&quot;,
			&quot;_id&quot; : ObjectId(&quot;4d0a54686a931656bc000009&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclNickname&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;race_ethnicity&quot;,
			&quot;public&quot; : false,
			&quot;value&quot; : [ ],
			&quot;_id&quot; : ObjectId(&quot;4d0a62316a931656bc00000a&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclRaceEthnicity&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;middle_name&quot;,
			&quot;public&quot; : false,
			&quot;value&quot; : &quot;&quot;,
			&quot;_id&quot; : ObjectId(&quot;4d0a62316a931656bc00000b&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclMiddleName&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;last_name&quot;,
			&quot;public&quot; : false,
			&quot;value&quot; : &quot;&quot;,
			&quot;_id&quot; : ObjectId(&quot;4d0a62316a931656bc00000c&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclLastName&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;gender&quot;,
			&quot;public&quot; : false,
			&quot;value&quot; : &quot;Male&quot;,
			&quot;_id&quot; : ObjectId(&quot;4d0a62316a931656bc00000d&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclGender&quot;
		}
&lt;p&gt;,&lt;br/&gt;
		&lt;/p&gt;
{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;zip_code&quot;,
			&quot;public&quot; : false,
			&quot;value&quot; : &quot;&quot;,
			&quot;_id&quot; : ObjectId(&quot;4d0a62316a931656bc00000e&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclZipCode&quot;
		}
&lt;p&gt;,&lt;/p&gt;
		{
			&quot;circles&quot; : [ ],
			&quot;name&quot; : &quot;date_of_birth&quot;,
			&quot;public&quot; : false,
			&quot;value&quot; : null,
			&quot;_id&quot; : ObjectId(&quot;4d0a62316a931656bc00000f&quot;),
			&quot;_type&quot; : &quot;AccessControlledFields::AclDateOfBirth&quot;
		}
&lt;p&gt;	],&lt;br/&gt;
	&quot;confirmation_sent_at&quot; : &quot;Thu Dec 16 2010 12:02:12 GMT-0600 (CST)&quot;,&lt;br/&gt;
	&quot;confirmation_token&quot; : null,&lt;br/&gt;
	&quot;confirmed_at&quot; : &quot;Thu Dec 16 2010 12:03:20 GMT-0600 (CST)&quot;,&lt;br/&gt;
	&quot;connections_circle_of_trust&quot; : &lt;/p&gt;
{
		&quot;name&quot; : &quot;Connections&quot;,
		&quot;email&quot; : false,
		&quot;date_of_birth&quot; : false,
		&quot;race_ethnicity&quot; : false,
		&quot;gender&quot; : false,
		&quot;first_name&quot; : false,
		&quot;middle_name&quot; : false,
		&quot;last_name&quot; : false,
		&quot;zip_code&quot; : false,
		&quot;_id&quot; : ObjectId(&quot;4d0a54246a931656bc000008&quot;)
	}
&lt;p&gt;,&lt;br/&gt;
	&quot;created_at&quot; : &quot;Thu Dec 16 2010 12:02:12 GMT-0600 (CST)&quot;,&lt;br/&gt;
	&quot;current_sign_in_at&quot; : &quot;Thu Dec 16 2010 12:03:20 GMT-0600 (CST)&quot;,&lt;br/&gt;
	&quot;current_sign_in_ip&quot; : &quot;127.0.0.1&quot;,&lt;br/&gt;
	&quot;email&quot; : &quot;amos@amos.com&quot;,&lt;br/&gt;
	&quot;encrypted_password&quot; : &quot;$2a$10$/dgVQhHdIYjSJa6yz6RWbezcuVjzwT1rj70PpybwjzN56i8X8.aBu&quot;,&lt;br/&gt;
	&quot;first_name&quot; : &quot;Amos&quot;,&lt;br/&gt;
	&quot;gender&quot; : &quot;Male&quot;,&lt;br/&gt;
	&quot;last_name&quot; : &quot;&quot;,&lt;br/&gt;
	&quot;last_sign_in_at&quot; : &quot;Thu Dec 16 2010 12:03:20 GMT-0600 (CST)&quot;,&lt;br/&gt;
	&quot;last_sign_in_ip&quot; : &quot;127.0.0.1&quot;,&lt;br/&gt;
	&quot;memberships&quot; : [ ],&lt;br/&gt;
	&quot;middle_name&quot; : &quot;&quot;,&lt;br/&gt;
	&quot;nickname&quot; : &quot;aking&quot;,&lt;br/&gt;
	&quot;password_salt&quot; : &quot;$2a$10$/dgVQhHdIYjSJa6yz6RWbe&quot;,&lt;br/&gt;
	&quot;race_ethnicity&quot; : [ ],&lt;br/&gt;
	&quot;sign_in_count&quot; : 1,&lt;br/&gt;
	&quot;terms_acceptance&quot; : &quot;1&quot;,&lt;br/&gt;
	&quot;updated_at&quot; : &quot;Thu Dec 16 2010 13:02:09 GMT-0600 (CST)&quot;,&lt;br/&gt;
	&quot;zip_code&quot; : &quot;&quot;&lt;br/&gt;
}&lt;/p&gt;


&lt;p&gt;Query&lt;br/&gt;
=====&lt;br/&gt;
db.users.find({$or:[&lt;br/&gt;
{acl_fields:{$elemMatch:{name:{$ne:&quot;gender&quot;}, circles:{$in:[]}, value : /aking/i}}},&lt;br/&gt;
{acl_fields:{$elemMatch:{name:&quot;gender&quot;, circles:{$in:[]}, value : /^aking$/i}}},&lt;br/&gt;
{acl_fields:{$elemMatch:&lt;/p&gt;
{name:&quot;gender&quot;, public:true, value : /^aking$/i}
&lt;p&gt;}},&lt;br/&gt;
{acl_fields:{$elemMatch:{name:{$ne:&quot;gender&quot;}, public:true, value:/aking/i}}}]})&lt;/p&gt;</description>
                <environment>OSX, CentOS, Linux, 32 and 64 bit</environment>
        <key id="13989">SERVER-2239</key>
            <summary>indexes causing non-distinct results in $or query</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="aaron">Aaron Staple</assignee>
                                    <reporter username="adkron">Amos King</reporter>
                        <labels>
                    </labels>
                <created>Thu, 16 Dec 2010 23:13:27 +0000</created>
                <updated>Wed, 4 Feb 2015 20:19:43 +0000</updated>
                            <resolved>Mon, 14 Feb 2011 18:09:46 +0000</resolved>
                                    <version>1.6.3</version>
                    <version>1.6.4</version>
                    <version>1.6.5</version>
                                                    <component>Index Maintenance</component>
                    <component>Querying</component>
                    <component>Usability</component>
                                        <votes>1</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="23889" author="aaron" created="Mon, 14 Feb 2011 18:09:46 +0000"  >&lt;p&gt;Resolving because we have created a separate jira for the root cause.&lt;/p&gt;</comment>
                            <comment id="21532" author="aaron" created="Fri, 17 Dec 2010 17:56:05 +0000"  >&lt;p&gt;Ok, this is a real bug.  I&apos;ve filed &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2245&quot; title=&quot;$or deduping should use IndexSpec getKeys&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2245&quot;&gt;&lt;del&gt;SERVER-2245&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Just as a note to myself - the provided example doesn&apos;t fail in 1.7 but the underlying problem is still there.&lt;/p&gt;</comment>
                            <comment id="21521" author="adkron" created="Fri, 17 Dec 2010 12:00:51 +0000"  >&lt;p&gt;Change the indexes to this:&lt;/p&gt;


&lt;p&gt;db.system.indexes.find()&lt;br/&gt;
{ &quot;name&quot; : &quot;&lt;em&gt;id&lt;/em&gt;&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;_id&quot; : 1 }
&lt;p&gt; }&lt;br/&gt;
{ &quot;name&quot; : &quot;email_1_encrypted_password_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;email&quot; : 1, &quot;encrypted_password&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : true }&lt;br/&gt;
{ &quot;name&quot; : &quot;memberships_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;memberships&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : false }&lt;br/&gt;
{ &quot;name&quot; : &quot;acl_fields.public_1_acl_fields.circles_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;acl_fields.public&quot; : 1, &quot;acl_fields.circles&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : false }&lt;br/&gt;
{ &quot;name&quot; : &quot;acl_fields.value_1&quot;, &quot;ns&quot; : &quot;t1d_development.users&quot;, &quot;key&quot; : &lt;/p&gt;
{ &quot;acl_fields.value&quot; : 1 }
&lt;p&gt;, &quot;unique&quot; : false }&lt;/p&gt;


&lt;p&gt;Then you will get the duplicates again on 1.6.5&lt;/p&gt;</comment>
                            <comment id="21500" author="aaron" created="Fri, 17 Dec 2010 04:33:49 +0000"  >&lt;p&gt;I was unable to reproduce with 1.6.5 using the provided document, indexes, and query.  I believe the failure described is &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1883&quot; title=&quot;dropping previous clause or matches fails with nested field matches&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1883&quot;&gt;&lt;del&gt;SERVER-1883&lt;/del&gt;&lt;/a&gt; which has already been fixed and backported to 1.6.4.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="13997">SERVER-2245</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </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>Fri, 17 Dec 2010 04:33:49 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        13 years, 1 week, 2 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-2245'>SERVER-2245</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>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            13 years, 1 week, 2 days ago
                        </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>aaron</customfieldvalue>
            <customfieldvalue>adkron</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrp9zz:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>21509</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|ht0c8v:</customfieldvalue>

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