<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:48:58 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-18861] Queries matching null value should be fully covered by index</title>
                <link>https://jira.mongodb.org/browse/SERVER-18861</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Because of issue closing &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-18653&quot; title=&quot;Answering &amp;quot;equality to null&amp;quot; predicates with an index requires a FETCH stage&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-18653&quot;&gt;&lt;del&gt;SERVER-18653&lt;/del&gt;&lt;/a&gt; I open a feature request for the important improvement.&lt;/p&gt;

&lt;p&gt;Assume, we have a collectoin with documents like&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;   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;{}, {a:1}, {a:[]}, {a:null}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;Also we have an non sparse index on &quot;a&quot; field.&lt;/p&gt;

&lt;p&gt;If we query all documents where a doesnt exist or null with {&lt;tt&gt;a: null&lt;/tt&gt;}, an engine always fetches documents even having field indexed.&lt;/p&gt;

&lt;p&gt;Need to improve query planner to allow query null valued field and to build an index which can detect collisions with array values.&lt;/p&gt;</description>
                <environment></environment>
        <key id="209047">SERVER-18861</key>
            <summary>Queries matching null value should be fully covered by index</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-optimization">Backlog - Query Optimization</assignee>
                                    <reporter username="andrey.hohutkin@gmail.com">Andrey Hohutkin</reporter>
                        <labels>
                            <label>index-version</label>
                            <label>qopt-team</label>
                            <label>storch</label>
                    </labels>
                <created>Mon, 8 Jun 2015 11:29:18 +0000</created>
                <updated>Mon, 5 Dec 2022 17:31:52 +0000</updated>
                                            <version>3.0.3</version>
                                                    <component>Index Maintenance</component>
                    <component>Querying</component>
                                        <votes>19</votes>
                                    <watches>51</watches>
                                                                                                                <comments>
                            <comment id="4150880" author="alya.berciu" created="Wed, 27 Oct 2021 09:01:49 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=fuat.sungur&quot; class=&quot;user-hover&quot; rel=&quot;fuat.sungur&quot;&gt;fuat.sungur&lt;/a&gt;&#160;if the index is not multikey, we use a count scan (no fetch stage) for a count on an indexed field with {$eq: null} in 4.9.0 and above. So, for example, for a non-multikey index on field a, we can avoid a fetch stage for a query like the following:&lt;/p&gt;

&lt;p&gt;db.c.count({a: {$eq: null}})&lt;/p&gt;

&lt;p&gt;In this instance, instead of fetching the documents, we use two count scans joined by an OR stage to match both null and undefined.&lt;/p&gt;</comment>
                            <comment id="4144033" author="fuat.sungur" created="Sun, 24 Oct 2021 08:21:06 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=alya.berciu&quot; class=&quot;user-hover&quot; rel=&quot;alya.berciu&quot;&gt;alya.berciu&lt;/a&gt;, we have the similar problem with a customer that, $eq:null will cause unnecessary FETCH, however they are on version 4.4.&#160;&lt;/p&gt;

&lt;p&gt;Can we confirm that with the implementation of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-55065&quot; title=&quot;Null queries should be covered by index where possible with current index format&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-55065&quot;&gt;&lt;del&gt;SERVER-55065&lt;/del&gt;&lt;/a&gt;, with the version 4.9.0; we are utilizing the index in the case $eq:null; without fetch stage, if there is no array value in the field? Then we can ask them to upgrade (they are on Atlas).&#160;&lt;/p&gt;</comment>
                            <comment id="4098871" author="JIRAUSER1262490" created="Mon, 4 Oct 2021 11:43:10 +0000"  >&lt;p&gt;Thanks, mongo upgrade indeed resolved our issue&lt;/p&gt;</comment>
                            <comment id="4065939" author="alya.berciu" created="Thu, 16 Sep 2021 15:24:46 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=isaevdan%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;isaevdan@gmail.com&quot;&gt;isaevdan@gmail.com&lt;/a&gt;&#160;the first option (for non-multikey indexes) is implemented in versions 4.9.0 and above (see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-55065&quot; title=&quot;Null queries should be covered by index where possible with current index format&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-55065&quot;&gt;&lt;del&gt;SERVER-55065&lt;/del&gt;&lt;/a&gt;).&lt;/p&gt;</comment>
                            <comment id="4065028" author="JIRAUSER1262359" created="Thu, 16 Sep 2021 08:09:01 +0000"  >&lt;p&gt;Thanks for replies&lt;/p&gt;

&lt;p&gt;So as I understand there are two options:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;for not &apos;multikey&apos; index is to implement optimization to not do fetch for count (as I understand this is not implemented yet? I tried to execute commands from my initial comment on brand new collection without inserting [] value, and still end up with fetch phase)&lt;/li&gt;
	&lt;li&gt;even if the index is &apos;multikey&apos; implement optimization for predicate which includes both [] and null to not do fetch and thus give user a little bit of control about this (having in mind he knows whether there are cases with [] in his particular collection)&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;My question would be then if it is possible to implement any of the optimizations above?&#160;&lt;/p&gt;

&lt;p&gt;In general what is the recommendation to workaround such cases of filtering with null value?&lt;/p&gt;</comment>
                            <comment id="4062964" author="alya.berciu" created="Wed, 15 Sep 2021 15:54:56 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=isaevdan%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;isaevdan@gmail.com&quot;&gt;isaevdan@gmail.com&lt;/a&gt; , &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=charlie.swanson&quot; class=&quot;user-hover&quot; rel=&quot;charlie.swanson&quot;&gt;charlie.swanson&lt;/a&gt; is correct: in your first example, we don&#8217;t use a COUNT_SCAN stage, nor do we just use an IXSCAN stage without a FETCH, because the index is multikey and therefore cannot differentiate between the [], null, and missing values for the indexed field &#8216;Value&#8217;.&lt;/p&gt;

&lt;p&gt;For your second example, the execution plan would be using COUNT_SCANs with no FETCH stage if your index is not multikey. Your index may be multikey if at some point a document in your collection had a &apos;Value&apos; field that was an array.&lt;/p&gt;

&lt;p&gt;To elaborate on Charlie&apos;s explanation, because the index itself stores null, missing, and [] in the same way, if we counted what the index scan returns for this predicate, we would also count empty arrays, which is incorrect. That&#8217;s why we need to fetch the document first, so we can see the actual value of &#8216;Value&#8217;, which based on the index would include any documents whose &#8216;Value&#8217; field is either null, missing, or [], and then filter out documents where the &#8216;Value&#8217; field is [].&lt;/p&gt;

&lt;p&gt;Therefore we wouldn&#8217;t be able to eliminate the filter stage at all for this specific predicate on a multikey index, though we should be able to do it for a predicate which includes empty arrays (I don&apos;t think we currently do this, however).&lt;/p&gt;</comment>
                            <comment id="4062904" author="JIRAUSER1262359" created="Wed, 15 Sep 2021 15:41:28 +0000"  >&lt;p&gt;I didn&apos;t know that array value marks index as &apos;multikey&apos;, and added that values just to illustrate that points(2,4) from this comment&#160;do not apply&#160;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-18653?focusedCommentId=931817&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-931817&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-18653?focusedCommentId=931817&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-931817&lt;/a&gt;&#160;(I don&apos;t know why links is no visible in initial comment). In fact I do have only&#160; 2 cases&lt;/p&gt;

{ Value: null }

{ Value: \{ _id: someid and other date}
&lt;p&gt; }&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;I don&apos;t even have cases without field Value in place. And when I try to count all records with { Value : null } I end up with fetch stage and slow query&lt;/p&gt;

&lt;p&gt;So can this case be solved with engine optimizations?&lt;/p&gt;</comment>
                            <comment id="4062654" author="charlie.swanson" created="Wed, 15 Sep 2021 14:38:55 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=isaevdan%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;isaevdan@gmail.com&quot;&gt;isaevdan@gmail.com&lt;/a&gt;&#160;I&apos;d be interested in &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=alya.berciu&quot; class=&quot;user-hover&quot; rel=&quot;alya.berciu&quot;&gt;alya.berciu&lt;/a&gt;&apos;s opinion as well, but it seems to me that we could not eliminate the fetch stage in your example due to the &lt;tt&gt;Value: []&lt;/tt&gt; document which makes the index &quot;multikey&quot;. This &quot;multikey&quot; tag simply means there was at least one array value inserted, so there are potentially multiple index keys per document. Once the index is multikey, it is not eligible for a COUNT_SCAN because there could be multiple index entries for a single document which would incorrectly inflate the count. &lt;/p&gt;

&lt;p&gt;In your example that is clearly not the case, but the system metadata does not currently distinguish between you inserting an &lt;em&gt;empty&lt;/em&gt; array like you do here vs a full array like Value: &lt;span class=&quot;error&quot;&gt;&amp;#91;3, 4, 5&amp;#93;&lt;/span&gt; or Value: &lt;span class=&quot;error&quot;&gt;&amp;#91;null, null&amp;#93;&lt;/span&gt;. We would not want to count each of 3, 4, 5 separately nor would we want to count both of the nulls separately. See also &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-5580&quot; title=&quot;covered indexes are improperly applied when arrays do not have multiple values&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-5580&quot;&gt;&lt;del&gt;SERVER-5580&lt;/del&gt;&lt;/a&gt; which describes why we have to consider empty or singleton arrays as multikey even though they do not generate multiple keys.&lt;/p&gt;

&lt;p&gt;We &lt;em&gt;might&lt;/em&gt; be able to get rid of the filter on Value: {$eq: null} in this case, but I&apos;m not optimistic that it would have a dramatic impact on query performance. &lt;/p&gt;</comment>
                            <comment id="4062353" author="JIRAUSER1262359" created="Wed, 15 Sep 2021 13:14:28 +0000"  >&lt;p&gt;Hi, I have a very specific case and went though all of the discussion around this topic and I think that this case might be optimized in engine without any new features. Please correct me if I&apos;m wrong.&lt;/p&gt;

&lt;p&gt;My case is that I have a following collection:&lt;/p&gt;

&lt;p&gt;db.test.insert({Value: []})&lt;br/&gt;
 db.test.insert({Value: null})&lt;br/&gt;
 db.test.insert({Value: 1})&lt;br/&gt;
 db.test.insert({})&lt;/p&gt;

&lt;p&gt;and index&lt;/p&gt;

&lt;p&gt;db.test.createIndex({Value: 1})&lt;/p&gt;

&lt;p&gt;I execute query&lt;/p&gt;

&lt;p&gt;db.test.count({Value: null})&lt;/p&gt;

&lt;p&gt;From query plan I see that there is fetch stage with filter Value: {$eq : null}&lt;/p&gt;

&lt;p&gt;As I understand there is no reason for this, since I don&apos;t need to know which case exactly is there(missing field or null value) for count operation. Also since this is a root level field points 2 and 4 from this comment do not apply here. If I&apos;m right is that possible to implement optimization for count operation on root level fields?&#160;&lt;/p&gt;</comment>
                            <comment id="3654933" author="alya.berciu" created="Tue, 9 Mar 2021 17:08:17 +0000"  >&lt;p&gt;CC &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=anton.korshunov&quot; class=&quot;user-hover&quot; rel=&quot;anton.korshunov&quot;&gt;anton.korshunov&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Until the new index format is available, this issue cannot be fully fixed. In the meantime, we are using another ticket to track some tactical improvements: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-55065&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-55065&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="3630195" author="charlie.swanson" created="Tue, 23 Feb 2021 15:34:18 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=alya.berciu&quot; class=&quot;user-hover&quot; rel=&quot;alya.berciu&quot;&gt;alya.berciu&lt;/a&gt; as we discussed during standup, this optimization may still make sense if the index is not &quot;multikey&quot; and has never seen any array values inserted. It becomes more fragile of an optimization, but I think still worthwhile. &lt;/p&gt;

&lt;p&gt;Assigning this back to you to take another look to make sure that works.&lt;/p&gt;</comment>
                            <comment id="3332093" author="JIRAUSER1255461" created="Tue, 11 Aug 2020 10:04:54 +0000"  >&lt;p&gt;Any plans to solve this issue ?&lt;/p&gt;

&lt;p&gt;Any recommend workaround on this issue ?&lt;/p&gt;

&lt;p&gt;We have skip and count() commands using a: null, and they are loading all documents, ignoring the existent index&lt;/p&gt;

&lt;p&gt;Tks.&lt;/p&gt;</comment>
                            <comment id="3032263" author="daniel@openlearning.com" created="Thu, 9 Apr 2020 01:01:11 +0000"  >&lt;p&gt;OK, perhaps only the possibility of a missing field is enough to cause the problem.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Let me take a step back and try to explain better what I want. I have a collection with documents matching the following schema:&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;{&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;   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;  _id: ObjectId,&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;   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;  a: ObjectId | &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;null&lt;/span&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;,&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;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;


&lt;p&gt;I want to query for documents where a is null. Note that I already know that `a` is either `null` or an ObjectId, even if Mongo doesn&apos;t know.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;To do this I built the following index:&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;{&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;   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;  a: &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1&lt;/span&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;,&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;   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;  _id: &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1&lt;/span&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;,&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;}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;If I do the simple query:&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;   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;find({a: &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;null&lt;/span&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;}, {_id: &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1&lt;/span&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;})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;Then there is an unecessary FETCH stage with a filter for `a: null`, even though the field `a` is not in the projection. Also, in circumstances where there are more fields and other indexes, mongo will sometimes choose to use an index which is much less ideal, which causes a much more serious performance problem than a non covered query.&lt;/p&gt;

&lt;p&gt;So my question is, can I somehow change my query so that it matches the semantics of the index and it can be covered? I have chosen a projection that does not include the `a` field, so there should be no need for mongo to fetch anything from disk to return that field because I have not asked it to return that field at all.&lt;/p&gt;

&lt;p&gt;For example, given that missing values are included in null index keys, I could amend my query to also accept missing values:&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;   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;find({&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;$or&apos;&lt;/span&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;: [{a: &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;null&lt;/span&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;}, {a: {&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;$exists&apos;&lt;/span&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;: &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;false&lt;/span&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;}}]}, {_id: &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1&lt;/span&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;})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;But this still results in a FETCH stage.&lt;/p&gt;

&lt;p&gt;Based on &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-18653?focusedCommentId=931817&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-931817&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;this comment&lt;/a&gt;, mongo also creates null index keys for the empty array. So I attempted to amend my query again:&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;   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;find({&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;$or&apos;&lt;/span&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;: [{a: &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;null&lt;/span&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;}, {a: {&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;$exists&apos;&lt;/span&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;: &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;false&lt;/span&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;}}, {a: []}]}, {_id: &lt;/span&gt;&lt;span style=&quot;color: #009900; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1&lt;/span&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;})&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;But again, there is still an unecessary FETCH stage with a filter for `a` similar to my query, and mongo still does not always prefer to use the index on `a` which is I know is best suited to the query.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Is is possible to create a query that allows mongo to cover it an index by explicitly filtering for all the values that might generate a null key in the index? If so, how can I find what these possible values are?&lt;/p&gt;</comment>
                            <comment id="3026033" author="asya" created="Fri, 3 Apr 2020 21:15:46 +0000"  >&lt;p&gt;To summarize:&lt;/p&gt;

&lt;p&gt;When collection has an index on &lt;tt&gt;a&lt;/tt&gt; and two documents:&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;{_id:1}&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;{_id:2, a:null}&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;The query {{&lt;/p&gt;
{a:null}
&lt;p&gt;}} with projection {{&lt;/p&gt;
{a:1, _id:0}
&lt;p&gt;}} needs to match both the documents (which it can do from the index) but correct values for field &lt;tt&gt;a&lt;/tt&gt; can not be determined from the index and the documents must be fetched.&lt;/p&gt;</comment>
                            <comment id="3026013" author="asya" created="Fri, 3 Apr 2020 21:03:38 +0000"  >&lt;p&gt;&amp;gt; mismatch between the semantics of the query&#160; &lt;br class=&quot;atl-forced-newline&quot; /&gt;{a: null} and the index: &lt;br class=&quot;atl-forced-newline&quot; /&gt;{a: null}&lt;/p&gt;

&lt;p&gt;There is not a mismatch here - the issue is that both match &lt;tt&gt;null&lt;/tt&gt; and missing field. However to return that field value, the document has to be examined.&lt;/p&gt;

&lt;p&gt;In other words, if you query&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;   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; db.coll.find({a:null},{_id:0, a:1}) &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;and there is an index on &lt;tt&gt;a&lt;/tt&gt; we don&apos;t know whether to return&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;   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; { } &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;or&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;   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; { a: null} &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;only from the index, without examining the actual document.&lt;/p&gt;

&lt;p&gt;Index can fully answer the query {a:null} but it cannot cover the projection for the field from the index alone.&lt;/p&gt;</comment>
                            <comment id="3024511" author="daniel@openlearning.com" created="Fri, 3 Apr 2020 02:59:09 +0000"  >&lt;p&gt;I have just done some experiments on the latest version (4.2.5) and so far I&apos;ve failed to find a workaround. I understand that the issue occurs because there is a mismatch between the semantics of the query {a: null} and the index: {a: null}. Some workarounds I tried that did not work (under the assumption that the key a contains either null or a number):&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;querying in a way that matches the semantics of the index:&lt;/p&gt;

{a: &apos;$in&apos;: [null, []]}

&lt;p&gt;It&apos;s not clear to me why, but this still results in a FETCH+filter stage that filters even after the index is used to select documents indexes as {a: null}&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;Using a partial index:&lt;/p&gt;

&lt;p&gt;createIndex({a: 1}, {partialFilterExpression: {a: null}})&lt;/p&gt;

&lt;p&gt;or alternatively (with a matching query): createIndex({a: 1}, {partialFilterExpression: {a: &lt;/p&gt;
{&apos;$type&apos;: 10}
&lt;p&gt;}})&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;None of these workarounds work. Is there any alternative I&apos;m not seeing here to use covered queries involving null values?&lt;/p&gt;</comment>
                            <comment id="2423989" author="ahvetskovich@gmail.com" created="Wed, 18 Sep 2019 08:01:48 +0000"  >&lt;p&gt;Any plans on resolving this issue?&lt;/p&gt;</comment>
                            <comment id="2272279" author="kay.agahd@idealo.de" created="Wed, 5 Jun 2019 14:25:20 +0000"  >&lt;p&gt;so you may add &quot;depends on &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-12869&quot; title=&quot;Index null values and missing values differently&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-12869&quot;&gt;SERVER-12869&lt;/a&gt;&quot;&lt;/p&gt;</comment>
                            <comment id="2272170" author="david.storch" created="Wed, 5 Jun 2019 13:24:24 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=asya&quot; class=&quot;user-hover&quot; rel=&quot;asya&quot;&gt;asya&lt;/a&gt;, the meaning of &lt;tt&gt;$eq:null&lt;/tt&gt; predicates is to match documents where the path is either missing or contains a literal null value. Therefore, I don&apos;t think it makes sense to resolve this as a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-12869&quot; title=&quot;Index null values and missing values differently&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-12869&quot;&gt;SERVER-12869&lt;/a&gt;. They are related, but not precisely the same. Additionally, this ticket describes the problem whereas &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-12869&quot; title=&quot;Index null values and missing values differently&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-12869&quot;&gt;SERVER-12869&lt;/a&gt; describes a particular set of code changes that wouldn&apos;t necessarily resolve this problem. I&apos;m reopening this ticket.&lt;/p&gt;</comment>
                            <comment id="2268524" author="asya" created="Mon, 3 Jun 2019 14:20:06 +0000"  >&lt;p&gt;This issue can only be resolved by implementing/resolving &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-12869&quot; title=&quot;Index null values and missing values differently&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-12869&quot;&gt;SERVER-12869&lt;/a&gt; since current version of MongoDB indexes stores the same value for null and missing values, and to be able to cover queries that include $eq to null predicate clause and return that field, the index would have to store different values for the two.&lt;/p&gt;

&lt;p&gt;Closing as a duplicate.&lt;/p&gt;</comment>
                            <comment id="1056813" author="ramon.fernandez" created="Fri, 9 Oct 2015 18:24:07 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=andrey.hohutkin%40gmail.com&quot; class=&quot;user-hover&quot; rel=&quot;andrey.hohutkin@gmail.com&quot;&gt;andrey.hohutkin@gmail.com&lt;/a&gt;, I realized we moved this ticket into &quot;Needs Triage&quot;, but we never posted a public comment: this ticket will be considered in a future planning round. There&apos;s some ongoing internal discussion about semantics and their implications for existing apps. Updates will be posted to this ticket as they happen.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="114107">SERVER-12869</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="386034">SERVER-29326</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="1418504">SERVER-49845</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="599562">SERVER-36990</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="31458">SERVER-5065</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="344649">SERVER-27646</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="114107">SERVER-12869</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="206390">SERVER-18653</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1644583">SERVER-55065</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>21.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[5002K00000kFIBrQAO, 5002K00000mrnHBQAY, 5002K00000qebbVQAQ, 5002K00000xEeGoQAK, 5006R00001on79ZQAQ]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 5 Oct 2015 23:30:33 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        2 years, 15 weeks ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<a href='https://jira.mongodb.org/browse/SERVER-12869'>SERVER-12869</a>]]></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>alexander.golin@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            2 years, 15 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>alya.berciu@mongodb.com</customfieldvalue>
            <customfieldvalue>andrey.hohutkin@gmail.com</customfieldvalue>
            <customfieldvalue>ahvetskovich@gmail.com</customfieldvalue>
            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-query-optimization</customfieldvalue>
            <customfieldvalue>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>daniel@openlearning.com</customfieldvalue>
            <customfieldvalue>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>isaevdan@gmail.com</customfieldvalue>
            <customfieldvalue>denys.isaiev@synergysports.com</customfieldvalue>
            <customfieldvalue>fuat.sungur@mongodb.com</customfieldvalue>
            <customfieldvalue>kay.agahd@idealo.de</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
            <customfieldvalue>ronaldo@get-a-way.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrl3v3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr2gsv:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="4463">Query Optimization 2021-02-22</customfieldvalue>
    <customfieldvalue id="4465">Query Optimization 2021-03-08</customfieldvalue>

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

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