<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:23:54 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-10725] incorrect results from $ne query using sparse index</title>
                <link>https://jira.mongodb.org/browse/SERVER-10725</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I have a collection having PushCtx.credentials and _id indexes.&lt;br/&gt;
According to base content a query of the kind&lt;br/&gt;
db.user.find({ _id: ObjectId(&apos;522f16d7594e4df1158b48f1&apos;), &quot;PushCtx.credentials&quot;: { $ne: &lt;/p&gt;
{ oauth_token: &quot;token token token token token&quot;, oauth_token_secret: &quot;token secret&quot; }
&lt;p&gt; } })&lt;br/&gt;
may fail (the entry exists and the query does not return it)&lt;/p&gt;

&lt;p&gt;Adding hint({_id : 1}) makes the query work&lt;br/&gt;
db.user.find({ _id: ObjectId(&apos;522f16d7594e4df1158b48f1&apos;), &quot;PushCtx.credentials&quot;: { $ne: &lt;/p&gt;
{ oauth_token: &quot;token token token token token&quot;, oauth_token_secret: &quot;token secret&quot; }
&lt;p&gt; } }).hint({_id : 1})&lt;/p&gt;
{ &quot;_id&quot; : ObjectId(&quot;522f16d7594e4df1158b48f1&quot;), (...) }

&lt;p&gt;This is a problem for me, as I do have to perform an update on that query, and that hint does not work in such a case&lt;/p&gt;</description>
                <environment>Linux on PC</environment>
        <key id="89196">SERVER-10725</key>
            <summary>incorrect results from $ne query using sparse index</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="9">Done</resolution>
                                        <assignee username="hari.khalsa@10gen.com">hari.khalsa@10gen.com</assignee>
                                    <reporter username="chris92000">Christophe Pizzuti</reporter>
                        <labels>
                            <label>$ne</label>
                            <label>query</label>
                            <label>query_triage</label>
                    </labels>
                <created>Tue, 10 Sep 2013 14:24:53 +0000</created>
                <updated>Mon, 11 Jul 2016 17:39:05 +0000</updated>
                            <resolved>Thu, 7 Nov 2013 17:42:15 +0000</resolved>
                                    <version>2.4.6</version>
                    <version>2.4.7</version>
                    <version>2.5.3</version>
                                    <fixVersion>2.5.4</fixVersion>
                                    <component>Querying</component>
                                        <votes>1</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="422467" author="zhifan" created="Wed, 11 Sep 2013 07:31:35 +0000"  >&lt;p&gt;Yes,  you are right.   according to the current code of isSimpleIdQuery,  do we aim at some queries which only have _id=? condition, not ( _id=? and xxx ... ).  I think only if the query part is not (  _id=?  or ... ), we can return true at isSimpleIdQuery().  but That would be more work to do. &lt;/p&gt;</comment>
                            <comment id="422459" author="eliot" created="Wed, 11 Sep 2013 07:06:11 +0000"  >&lt;p&gt;I think I see why that makes that query work, but its not doing the right thing.&lt;br/&gt;
That patch would ignore everything but the _id part of the query.&lt;br/&gt;
I think the real bug is deeper down.&lt;/p&gt;</comment>
                            <comment id="422454" author="zhifan" created="Wed, 11 Sep 2013 06:54:42 +0000"  >&lt;p&gt;Very interested in mongodb.  &lt;/p&gt;

&lt;p&gt;seems the cause is function isSimpleIdQuery().  &lt;/p&gt;

&lt;p&gt;I can fix it with the following change:&lt;br/&gt;
        while(i.more())&lt;/p&gt;
{
                e = i.next();
                if( strcmp(&quot;_id&quot;, e.fieldName()) == 0 &amp;amp;&amp;amp; e.isSimpleType() )
                        return true;
        }
&lt;p&gt;    &lt;/p&gt;

&lt;p&gt;/*&lt;br/&gt;
        BSONElement e = i.next();&lt;/p&gt;

&lt;p&gt;        if( i.more() ) &lt;br/&gt;
            return false;&lt;/p&gt;

&lt;p&gt;        if( strcmp(&quot;_id&quot;, e.fieldName()) != 0 ) &lt;br/&gt;
            return false;&lt;/p&gt;

&lt;p&gt;        if ( e.isSimpleType() ) // e.g. not something like { _id : { $gt : ...&lt;br/&gt;
*/      &lt;/p&gt;</comment>
                            <comment id="422409" author="eliot" created="Wed, 11 Sep 2013 04:36:37 +0000"  >&lt;p&gt;Able to reproduce.&lt;br/&gt;
Works with non sparse indexes, so that is the workaround for now.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="33569" name="server10725.js" size="356" author="benety.goh@mongodb.com" created="Thu, 7 Nov 2013 17:43:46 +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>Wed, 11 Sep 2013 04:36:37 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        10 years, 23 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></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>
                            10 years, 23 weeks 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>zhifan</customfieldvalue>
            <customfieldvalue>chris92000</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>hari.khalsa@10gen.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrmhan:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>5717</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Commands from a mongo shell&lt;/p&gt;

&lt;p&gt;db.user.drop()&lt;br/&gt;
db.user.ensureIndex(&lt;/p&gt;
{mail:1}
&lt;p&gt;,&lt;/p&gt;
{unique:1, safe:1}
&lt;p&gt;)&lt;br/&gt;
db.user.ensureIndex(&lt;/p&gt;
{&quot;applications.last_ip&quot;:1}
&lt;p&gt;,&lt;/p&gt;
{sparse:1, safe:1}
&lt;p&gt;)&lt;br/&gt;
db.user.ensureIndex(&lt;/p&gt;
{&quot;PushCtx.credentials&quot;:1}
&lt;p&gt;,&lt;/p&gt;
{unique:1, sparse:1, dropDups:1, safe:1}
&lt;p&gt;)&lt;br/&gt;
db.user.insert({ &quot;_id&quot; : ObjectId(&quot;522f16d7594e4df1158b48f1&quot;), &quot;administrative&quot; : &lt;/p&gt;
{ &quot;langage&quot; : &quot;french&quot;, &quot;units&quot; : &quot;meter&quot; }
&lt;p&gt;, &quot;applications&quot; : [ &lt;/p&gt;
{ &quot;application&quot; : ObjectId(&quot;522f16d7594e4df1158b48f2&quot;), &quot;access_token&quot; : &quot;522f16d7594e4df1158b48f1|uac2_1&quot;, &quot;refresh_token&quot; : &quot;uref2_1&quot; }
&lt;p&gt;, &lt;/p&gt;
{ &quot;application&quot; : ObjectId(&quot;522f16d7594e4df1158b48f3&quot;), &quot;access_token&quot; : &quot;522f16d7594e4df1158b48f1|uac2_2&quot;, &quot;refresh_token&quot; : &quot;uref2_2&quot;, &quot;last_ip&quot; : &quot;1.1.1.1&quot;, &quot;last_ip_date&quot; : ISODate(&quot;2013-09-10T12:55:51.319Z&quot;) }
&lt;p&gt; ], &quot;devices&quot; : [  &quot;unitmac2&quot; ], &quot;mail&quot; : &quot;unituser2@netatmo.com&quot;, &quot;password&quot; : &quot;password&quot; })&lt;br/&gt;
db.user.find({ _id: ObjectId(&apos;522f16d7594e4df1158b48f1&apos;), &quot;PushCtx.credentials&quot;: { $ne: &lt;/p&gt;
{ oauth_token: &quot;token token token token token&quot;, oauth_token_secret: &quot;token secret&quot; }
&lt;p&gt; } })&lt;/p&gt;</customfieldvalue>

                        </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|hspbmv:</customfieldvalue>

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