<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:33:30 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-13986] Creating a sparse index makes the not equals query to return diferent results.</title>
                <link>https://jira.mongodb.org/browse/SERVER-13986</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;The documentation&lt;a href=&quot;http://docs.mongodb.org/manual/reference/operator/query/ne/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/reference/operator/query/ne/&lt;/a&gt; descrive the &apos;$ne&apos; function as:&lt;/p&gt;

&lt;p&gt;$ne selects the documents where the value of the field is not equal (i.e. !=) to the specified value. This includes documents that do not contain the field.&lt;/p&gt;

&lt;p&gt;However this becames is false when the queried value have an sparse index.&lt;/p&gt;

&lt;p&gt;I can workarround but is a extrange behaivour when you don&apos;t expect it.&lt;/p&gt;</description>
                <environment></environment>
        <key id="137107">SERVER-13986</key>
            <summary>Creating a sparse index makes the not equals query to return diferent results.</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="hari.khalsa@10gen.com">hari.khalsa@10gen.com</assignee>
                                    <reporter username="mabodo">David Martin-Borregon</reporter>
                        <labels>
                    </labels>
                <created>Mon, 19 May 2014 09:26:41 +0000</created>
                <updated>Mon, 11 Jul 2016 17:18:25 +0000</updated>
                            <resolved>Mon, 19 May 2014 14:24:00 +0000</resolved>
                                    <version>2.4.10</version>
                                    <fixVersion>2.6.0</fixVersion>
                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="588937" author="david.storch" created="Mon, 19 May 2014 15:23:47 +0000"  >&lt;p&gt;For more information, see the docs here: &lt;a href=&quot;http://docs.mongodb.org/master/core/index-sparse/#sparse-index-incomplete-results&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/master/core/index-sparse/#sparse-index-incomplete-results&lt;/a&gt;. Or, see related tickets &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13324&quot; title=&quot;Sparse index is not used to filter {field: {$ne: null}} queries&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13324&quot;&gt;&lt;del&gt;SERVER-13324&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-13939&quot; title=&quot;Unexpected behavior of query planner with sparse indices&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-13939&quot;&gt;&lt;del&gt;SERVER-13939&lt;/del&gt;&lt;/a&gt;, and &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-12684&quot; title=&quot;incorrect result and index not used for $ne with sparse index&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-12684&quot;&gt;&lt;del&gt;SERVER-12684&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="588859" author="hari.khalsa@10gen.com" created="Mon, 19 May 2014 14:23:38 +0000"  >&lt;p&gt;This was fixed in 2.6 and was a known issue in 2.4.x.  Negations do not use sparse indices in 2.6.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="110407">SERVER-12684</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="124651">SERVER-13324</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="136378">SERVER-13939</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 19 May 2014 14:23:38 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 39 weeks, 2 days 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>
                            9 years, 39 weeks, 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>mabodo</customfieldvalue>
            <customfieldvalue>david.storch@mongodb.com</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|hrlurb:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>118038</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;in python:&lt;/p&gt;

&lt;p&gt;    import pymongo&lt;br/&gt;
    conn = pymongo.MongoClient()&lt;br/&gt;
    db = conn&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;spare-test&amp;#39;&amp;#93;&lt;/span&gt;&lt;br/&gt;
    col = db&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;#39;spare-test&amp;#39;&amp;#93;&lt;/span&gt;&lt;br/&gt;
    col.drop()&lt;br/&gt;
    col.insert(&lt;/p&gt;
{&apos;_id&apos;:0}
&lt;p&gt;)&lt;br/&gt;
    col.insert(&lt;/p&gt;
{&apos;_id&apos;:1, &apos;val&apos;:1}
&lt;p&gt;)&lt;br/&gt;
    col.insert(&lt;/p&gt;
{&apos;_id&apos;:2, &apos;val&apos;:2}
&lt;p&gt;)&lt;br/&gt;
    col.insert(&lt;/p&gt;
{&apos;_id&apos;:3, &apos;val&apos;:3}
&lt;p&gt;)&lt;br/&gt;
    print col.find({&apos;val&apos;:{&apos;$ne&apos;:2}}).count()&lt;br/&gt;
    col.ensure_index(&lt;span class=&quot;error&quot;&gt;&amp;#91;(&amp;#39;val&amp;#39;,1)&amp;#93;&lt;/span&gt;, sparse=True)&lt;br/&gt;
    print col.find({&apos;val&apos;:{&apos;$ne&apos;:2}}).count()&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_11861" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>User Summary</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="11856"><![CDATA[Not Needed]]></customfieldvalue>

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

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