<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 05:21:00 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-49845] allow indices to optionally cover missing values</title>
                <link>https://jira.mongodb.org/browse/SERVER-49845</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I often need to run queries of the form {a: {$ne:null}}, i.e. find documents in which the field &quot;a&quot; is not missing and not equal to null. As I understand it, an index on &quot;a&quot; will not cover this query because the index will not include documents where &quot;a&quot; is missing.&lt;/p&gt;

&lt;p&gt;In these cases I find myself forced to always include a value for &quot;a&quot;. This isn&apos;t hard to do - generally there&apos;s always some value I can reserve for this purpose (often &quot;null&quot; of course, but sometimes another value if &quot;null&quot; doesn&apos;t mean the same thing as a missing value).&lt;/p&gt;

&lt;p&gt;It seems to me that mongo could do this for me transparently (by reserving a value to indicate &quot;missing&quot; and including those documents in the index). I completely understand that minimizing index size is important, and this wouldn&apos;t be appropriate in many contexts, and certainly not as a default. Nevertheless, this comes up over and over again (I&apos;ve been running an expansive production environment on mongo for many years). So I think it would make an incredibly useful option when creating an index.&lt;/p&gt;

&lt;p&gt;Apologies if I&apos;m missing something about why this isn&apos;t feasible (or perhaps feasible but not simple) to implement, or why it&apos;s not a good idea. I tried to cover this in a bit more detail on stack overflow before submitting this request:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://stackoverflow.com/questions/63003917&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://stackoverflow.com/questions/63003917&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="1418504">SERVER-49845</key>
            <summary>allow indices to optionally cover missing values</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="3">Duplicate</resolution>
                                        <assignee username="asya.kamsky@mongodb.com">Asya Kamsky</assignee>
                                    <reporter username="jeremy@nonagontech.com">Jeremy Todd</reporter>
                        <labels>
                            <label>qopt-team</label>
                    </labels>
                <created>Thu, 23 Jul 2020 18:30:40 +0000</created>
                <updated>Tue, 28 Jul 2020 18:48:54 +0000</updated>
                            <resolved>Tue, 28 Jul 2020 18:48:54 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="3310568" author="asya" created="Tue, 28 Jul 2020 18:48:54 +0000"  >&lt;p&gt;I&apos;m closing this as fundamentally being the same as &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-18861&quot; title=&quot;Queries matching null value should be fully covered by index&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-18861&quot;&gt;SERVER-18861&lt;/a&gt; - there are some cases where null equality still causes a FETCH and a less efficient plan to be selected and you may have been looking at one of them.&lt;/p&gt;</comment>
                            <comment id="3310213" author="jeremy@nonagontech.com" created="Tue, 28 Jul 2020 16:27:11 +0000"  >&lt;p&gt;Understood - sorry for the bogus feature request! I must have been thinking about queries of this form not leading to COUNT_SCAN operations, discussed here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://mongodb-user.narkive.com/MKpJkCNh/count-scan-vs-ixscan-when-query-includes-null&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://mongodb-user.narkive.com/MKpJkCNh/count-scan-vs-ixscan-when-query-includes-null&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;which led to feature request&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-18861&quot; title=&quot;Queries matching null value should be fully covered by index&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-18861&quot;&gt;SERVER-18861&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Those are all issues separate from this feature request though.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="3310193" author="asya" created="Tue, 28 Jul 2020 16:20:30 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-27646&quot; title=&quot;covered index should be used when null inequality is in the query and index is not multikey&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-27646&quot;&gt;&lt;del&gt;SERVER-27646&lt;/del&gt;&lt;/a&gt; resolved this for 4.2 - if you are using older server you may see different behavior (related ticket &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-36465&quot; title=&quot;Non-multikey sparse indexes can be used to answer query with {$ne:null} predicate&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-36465&quot;&gt;&lt;del&gt;SERVER-36465&lt;/del&gt;&lt;/a&gt; was also fixed for 4.2)&lt;/p&gt;</comment>
                            <comment id="3310070" author="asya" created="Tue, 28 Jul 2020 15:31:33 +0000"  >&lt;p&gt;&amp;gt; I often need to run queries of the form {a: {$ne:null}}, i.e. find documents in which the field &quot;a&quot; is not missing and not equal to null. As I understand it, an index on &quot;a&quot; will not cover this query because the index will not include documents where &quot;a&quot; is missing.&lt;/p&gt;

&lt;p&gt;This understanding is incorrect - an index will cover this.&lt;/p&gt;</comment>
                            <comment id="3300744" author="jonathan.streets" created="Fri, 24 Jul 2020 13:07:44 +0000"  >&lt;p&gt;hi Jeremy,&lt;br/&gt;
Thank you for the example and the link to the discussion on stackoverflow. We&apos;re assigning this ticket to the appropriate team to be evaluated against our currently planned work. Updates will be posted on this ticket as they happen.&lt;br/&gt;
Jon&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="209047">SERVER-18861</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>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 24 Jul 2020 13:07:44 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        3 years, 28 weeks, 1 day 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>asya.kamsky@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            3 years, 28 weeks, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>jeremy@nonagontech.com</customfieldvalue>
            <customfieldvalue>jonathan.streets@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hxwcy7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hxj713:</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>
                                                                                            <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|hxvz7j:</customfieldvalue>

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