<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 02:55:39 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-958] Range queries on arrays behave differently with indexes</title>
                <link>https://jira.mongodb.org/browse/SERVER-958</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;&amp;gt; db.test.insert(&lt;/p&gt;
{a:[1,10]}
&lt;p&gt;)&lt;br/&gt;
&amp;gt; db.test.find({a: {$gt: 2, $lt:5}})&lt;/p&gt;
{ &quot;_id&quot; : ObjectId(&quot;4bb9be0accf9c6e519c4d1fe&quot;), &quot;a&quot; : [ 1, 10 ] }
&lt;p&gt;&amp;gt; db.test.ensureIndex(&lt;/p&gt;
{a:1}
&lt;p&gt;)&lt;br/&gt;
&amp;gt; db.test.find({a: {$gt: 2, $lt:5}})&lt;br/&gt;
&amp;gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="11692">SERVER-958</key>
            <summary>Range queries on arrays behave differently with indexes</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="aaron">Aaron Staple</assignee>
                                    <reporter username="mathias@mongodb.com">Mathias Stearn</reporter>
                        <labels>
                    </labels>
                <created>Sun, 4 Apr 2010 15:01:36 +0000</created>
                <updated>Tue, 12 Jul 2016 00:27:55 +0000</updated>
                            <resolved>Mon, 16 May 2011 19:42:57 +0000</resolved>
                                                    <fixVersion>1.9.1</fixVersion>
                                    <component>Querying</component>
                                        <votes>1</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="32956" author="aaron" created="Mon, 16 May 2011 18:47:21 +0000"  >&lt;p&gt;A few related todos&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3102&quot; title=&quot;invalidate querypattern when index becomes multikey&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3102&quot;&gt;&lt;del&gt;SERVER-3102&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3103&quot; title=&quot;key check optimization for multikey index in covered matcher&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3103&quot;&gt;&lt;del&gt;SERVER-3103&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-3104&quot; title=&quot;index bound improvements for elemMatch query on multikey index&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-3104&quot;&gt;&lt;del&gt;SERVER-3104&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="30657" author="auto" created="Mon, 2 May 2011 18:10:23 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-958&quot; title=&quot;Range queries on arrays behave differently with indexes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-958&quot;&gt;&lt;del&gt;SERVER-958&lt;/del&gt;&lt;/a&gt; Looser bounds for multikey indexes with parallel nested fields&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/e780ffc12fc56885566a93f5fa97f8281885f334&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/e780ffc12fc56885566a93f5fa97f8281885f334&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="30656" author="auto" created="Mon, 2 May 2011 18:10:21 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-958&quot; title=&quot;Range queries on arrays behave differently with indexes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-958&quot;&gt;&lt;del&gt;SERVER-958&lt;/del&gt;&lt;/a&gt; Prefer fully contained multikey ranges since they are smaller.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/4786360d414f6b4421a71456222866c9a4f033fa&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/4786360d414f6b4421a71456222866c9a4f033fa&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="29628" author="auto" created="Mon, 25 Apr 2011 23:44:09 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-958&quot; title=&quot;Range queries on arrays behave differently with indexes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-958&quot;&gt;&lt;del&gt;SERVER-958&lt;/del&gt;&lt;/a&gt; merge and address mongos dependency differences&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/3af50f5b941a07b0f290c7f8ee2726c85e2d0699&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/3af50f5b941a07b0f290c7f8ee2726c85e2d0699&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="29617" author="auto" created="Mon, 25 Apr 2011 21:05:40 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-958&quot; title=&quot;Range queries on arrays behave differently with indexes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-958&quot;&gt;&lt;del&gt;SERVER-958&lt;/del&gt;&lt;/a&gt; merge and address mongos dependency differences&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/3af50f5b941a07b0f290c7f8ee2726c85e2d0699&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/3af50f5b941a07b0f290c7f8ee2726c85e2d0699&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="29613" author="auto" created="Mon, 25 Apr 2011 21:05:33 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-958&quot; title=&quot;Range queries on arrays behave differently with indexes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-958&quot;&gt;&lt;del&gt;SERVER-958&lt;/del&gt;&lt;/a&gt; &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2864&quot; title=&quot;query pattern cannot be created for an &amp;#39;invalid&amp;#39; key range&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2864&quot;&gt;&lt;del&gt;SERVER-2864&lt;/del&gt;&lt;/a&gt; tests&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/8e92ba9ac0dfba5865810a1a26f5934d69e70fe3&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/8e92ba9ac0dfba5865810a1a26f5934d69e70fe3&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="29612" author="auto" created="Mon, 25 Apr 2011 21:05:31 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-958&quot; title=&quot;Range queries on arrays behave differently with indexes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-958&quot;&gt;&lt;del&gt;SERVER-958&lt;/del&gt;&lt;/a&gt; tests&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/870fedc9e1dea57532d109782b2a31378b32f16c&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/870fedc9e1dea57532d109782b2a31378b32f16c&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="29611" author="auto" created="Mon, 25 Apr 2011 21:05:29 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-958&quot; title=&quot;Range queries on arrays behave differently with indexes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-958&quot;&gt;&lt;del&gt;SERVER-958&lt;/del&gt;&lt;/a&gt; Update matcher and matcher usage for better non single key range support&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/f799371da9b38f65b68abec09d4b9738fe6d1c66&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/f799371da9b38f65b68abec09d4b9738fe6d1c66&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="29610" author="auto" created="Mon, 25 Apr 2011 21:05:28 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;login&apos;: u&apos;astaple&apos;, u&apos;name&apos;: u&apos;Aaron&apos;, u&apos;email&apos;: u&apos;aaron@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-958&quot; title=&quot;Range queries on arrays behave differently with indexes&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-958&quot;&gt;&lt;del&gt;SERVER-958&lt;/del&gt;&lt;/a&gt; Track non single key field ranges and utilize them in query planning&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a22732613243b36d91170d2ba6d5b492f36f3722&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a22732613243b36d91170d2ba6d5b492f36f3722&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="19122" author="eliot" created="Tue, 12 Oct 2010 18:54:49 +0000"  >&lt;p&gt;Yes and Yes.&lt;/p&gt;</comment>
                            <comment id="19118" author="aaron" created="Tue, 12 Oct 2010 18:27:17 +0000"  >&lt;p&gt;If you want that to be the correct solution, then I don&apos;t think we&apos;ll ever be able to do a closed range index search on an index where multikeys are used.  In the above example, we&apos;d need to scan the index either for all documents where a &amp;lt; 5 or all documents where a &amp;gt; 2.  Also, how should I pick which of those ranges to scan?  Just use the first one?&lt;/p&gt;</comment>
                            <comment id="19116" author="eliot" created="Tue, 12 Oct 2010 18:07:29 +0000"  >&lt;p&gt;Without the index is correct.&lt;/p&gt;</comment>
                            <comment id="19115" author="aaron" created="Tue, 12 Oct 2010 18:03:45 +0000"  >&lt;p&gt;Ok - which is the correct result?  The one with the index or without?&lt;/p&gt;</comment>
                            <comment id="18836" author="jerry" created="Sun, 3 Oct 2010 23:42:12 +0000"  >&lt;p&gt;Nevermind on my last comment.&lt;/p&gt;</comment>
                            <comment id="18835" author="jerry" created="Sun, 3 Oct 2010 23:28:11 +0000"  >&lt;p&gt;The possible workaround thus far:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.test.find({a:{$lt:5, $not:{$gte:2}}})&lt;/p&gt;

&lt;p&gt;I believe the technical term for this is &quot;hax!&quot;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="13360">SERVER-1937</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="15374">SERVER-2864</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="15375">SERVER-2865</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is depended on by">
                                        <issuelink>
            <issuekey id="13832">SERVER-2165</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="14106">SERVER-2302</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="11902">SERVER-1089</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="17140">SERVER-3102</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="17140">SERVER-3102</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="17141">SERVER-3103</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="17142">SERVER-3104</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="13349">SERVER-1932</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>15.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sun, 3 Oct 2010 23:28:11 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        12 years, 40 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-1937'>SERVER-1937</a></s>, <s><a href='https://jira.mongodb.org/browse/SERVER-2864'>SERVER-2864</a></s>, <s><a href='https://jira.mongodb.org/browse/SERVER-2865'>SERVER-2865</a></s>]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            12 years, 40 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>aaron</customfieldvalue>
            <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>jerry</customfieldvalue>
            <customfieldvalue>mathias@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrj07z:</customfieldvalue>

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

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

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