<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:05:07 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-4155] Index bound incorrect?</title>
                <link>https://jira.mongodb.org/browse/SERVER-4155</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This appears to be a floating point issue. Please confirm. Issue is here:&lt;br/&gt;
&lt;a href=&quot;http://groups.google.com/group/mongodb-user/browse_thread/thread/b298eee9ef62cb1f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/browse_thread/thread/b298eee9ef62cb1f&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="24117">SERVER-4155</key>
            <summary>Index bound incorrect?</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="9">Done</resolution>
                                        <assignee username="aaron">Aaron Staple</assignee>
                                    <reporter username="kbanker">Kyle Banker</reporter>
                        <labels>
                    </labels>
                <created>Wed, 26 Oct 2011 19:34:11 +0000</created>
                <updated>Mon, 19 Aug 2013 11:43:26 +0000</updated>
                            <resolved>Fri, 30 Mar 2012 03:27:34 +0000</resolved>
                                                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="155213" author="aaron" created="Tue, 21 Aug 2012 05:44:42 +0000"  >&lt;p&gt;Hi Jack - In 2.2+ you can use $elemMatch to get the ranges you want, see &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-4180&quot; title=&quot;Allow multiple constraints (on same field) within a $elemMatch clause to be used with a multikey index&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-4180&quot;&gt;&lt;del&gt;SERVER-4180&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="155056" author="jack_xu" created="Mon, 20 Aug 2012 20:31:10 +0000"  >
&lt;p&gt;in mongod 2.0+, when I run the following query in a single element multikey indexed document, it works fine and leverages multikey index: &lt;/p&gt;

&lt;p&gt;db.objects.drop();&lt;br/&gt;
db.objects.save({attrib : [ &lt;/p&gt;
{d : 3}
&lt;p&gt;]})&lt;br/&gt;
db.objects.save({attrib : [ &lt;/p&gt;
{d : 5}
&lt;p&gt; ]})&lt;br/&gt;
db.objects.save({attrib : [ &lt;/p&gt;
{d : 7}
&lt;p&gt;]})&lt;br/&gt;
db.objects.ensureIndex(&lt;/p&gt;
{attrib : 1}
&lt;p&gt;)&lt;br/&gt;
db.objects.find({attrib: {$gt: &lt;/p&gt;
{d: 4}
&lt;p&gt;, $lt: &lt;/p&gt;
{d: 6}
&lt;p&gt;}}).explain();&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor attrib_1&quot;,&lt;br/&gt;
	&quot;isMultiKey&quot; : false,&lt;br/&gt;
	&quot;n&quot; : 1,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 1,&lt;br/&gt;
	&quot;nscanned&quot; : 1,&lt;br/&gt;
	&quot;nscannedObjectsAllPlans&quot; : 1,&lt;br/&gt;
	&quot;nscannedAllPlans&quot; : 1,&lt;br/&gt;
	&quot;scanAndOrder&quot; : false,&lt;br/&gt;
	&quot;indexOnly&quot; : false,&lt;br/&gt;
	&quot;nYields&quot; : 0,&lt;br/&gt;
	&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
	&quot;millis&quot; : 0,&lt;br/&gt;
	&quot;indexBounds&quot; : {&lt;br/&gt;
		&quot;attrib&quot; : [&lt;br/&gt;
			[&lt;br/&gt;
				&lt;/p&gt;
{
					&quot;d&quot; : 4
				}
&lt;p&gt;,&lt;/p&gt;
				{
					&quot;d&quot; : 6
				}
&lt;p&gt;			]&lt;br/&gt;
		]&lt;br/&gt;
	},&lt;br/&gt;
	&quot;server&quot; : &quot;lucid64:27017&quot;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;However, as soon as there are multiple elements in the array, one of the bounds is simply ignored! &lt;/p&gt;

&lt;p&gt;db.objects.drop();&lt;br/&gt;
db.objects.save({attrib : [ &lt;/p&gt;
{c : &apos;test&apos;}
&lt;p&gt; , &lt;/p&gt;
{d : 3}
&lt;p&gt; ]})&lt;br/&gt;
db.objects.save({attrib : [ &lt;/p&gt;
{c : &apos;test1&apos;}
&lt;p&gt;, &lt;/p&gt;
{d : 5}
&lt;p&gt;]})&lt;br/&gt;
db.objects.save({attrib : [ &lt;/p&gt;
{c : &apos;test3&apos;}
&lt;p&gt;, &lt;/p&gt;
{d : 7}
&lt;p&gt; ]})&lt;br/&gt;
db.objects.ensureIndex(&lt;/p&gt;
{attrib : 1}
&lt;p&gt;)&lt;br/&gt;
db.objects.find({attrib: {$gt: &lt;/p&gt;
{d: 4}
&lt;p&gt;, $lt: &lt;/p&gt;
{d: 6}
&lt;p&gt;}}).explain();&lt;/p&gt;

&lt;p&gt;{&lt;br/&gt;
	&quot;cursor&quot; : &quot;BtreeCursor attrib_1&quot;,&lt;br/&gt;
	&quot;isMultiKey&quot; : true,&lt;br/&gt;
	&quot;n&quot; : 2,&lt;br/&gt;
	&quot;nscannedObjects&quot; : 5,&lt;br/&gt;
	&quot;nscanned&quot; : 5,&lt;br/&gt;
	&quot;nscannedObjectsAllPlans&quot; : 5,&lt;br/&gt;
	&quot;nscannedAllPlans&quot; : 5,&lt;br/&gt;
	&quot;scanAndOrder&quot; : false,&lt;br/&gt;
	&quot;indexOnly&quot; : false,&lt;br/&gt;
	&quot;nYields&quot; : 0,&lt;br/&gt;
	&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
	&quot;millis&quot; : 0,&lt;br/&gt;
	&quot;indexBounds&quot; : {&lt;br/&gt;
		&quot;attrib&quot; : [&lt;br/&gt;
			[&lt;br/&gt;
				&lt;/p&gt;
{
					&quot;d&quot; : 4
				}
&lt;p&gt;,&lt;/p&gt;
				{
					&quot;$maxElement&quot; : 1
				}
&lt;p&gt;			]&lt;br/&gt;
		]&lt;br/&gt;
	},&lt;br/&gt;
	&quot;server&quot; : &quot;lucid64:27017&quot;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;I just wonder why &quot;we can&apos;t constrain the index on both upper and lower bounds&quot;, especially it is already working fine in 1.8.1.&lt;/p&gt;</comment>
                            <comment id="151012" author="sergejs.degtjars@abcsoftware.lv" created="Tue, 7 Aug 2012 08:15:18 +0000"  >&lt;p&gt;Looks like this problem is more complicated: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-6720&quot; title=&quot;Range query with compound multikey index scans more objects than needed&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-6720&quot;&gt;&lt;del&gt;SERVER-6720&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="105044" author="eliot" created="Fri, 30 Mar 2012 03:27:20 +0000"  >&lt;p&gt;The semantics wanted there are what $elemMatch are for.&lt;br/&gt;
I don&apos;t think changing the semantics of a query operator is a great idea at this point.&lt;/p&gt;</comment>
                            <comment id="104930" author="kbanker" created="Thu, 29 Mar 2012 19:33:36 +0000"  >&lt;p&gt;Can we reconsider this?&lt;/p&gt;</comment>
                            <comment id="104929" author="kbanker" created="Thu, 29 Mar 2012 19:33:06 +0000"  >&lt;p&gt;I think that we should reconsider this. Have a look at this issue:&lt;br/&gt;
&lt;a href=&quot;https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/3xfoqFW6uIA&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://groups.google.com/forum/?fromgroups#!topic/mongodb-user/3xfoqFW6uIA&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The user make a good point:&lt;br/&gt;
What we want is that any one key matches BOTH criteria, not any key matches either.&lt;/p&gt;

&lt;p&gt;In the example:&lt;br/&gt;
save &lt;/p&gt;
{a:[1,10]}
&lt;p&gt;query {a:{$gt:2,$lt:9}}&lt;/p&gt;

&lt;p&gt;I don&apos;t believe that the document should be returned. For example, what about this:&lt;br/&gt;
save (&lt;/p&gt;
{a: 1}
&lt;p&gt;)&lt;br/&gt;
query {a:{$gt:2,$lt:9}}&lt;/p&gt;

&lt;p&gt;In this case, both ranges are taken into account.&lt;/p&gt;

&lt;p&gt;This may be a case where we need a new operator to account for both semantics, but I believe that both are reasonable. Arguably, users can get the current, v2.0 semantic like this:&lt;br/&gt;
query {$or: [&lt;/p&gt;
{a:$gt:2}
&lt;p&gt;, {a: {$lt:9}}]}&lt;/p&gt;

</comment>
                            <comment id="62986" author="aaron" created="Thu, 27 Oct 2011 06:34:31 +0000"  >&lt;p&gt;The behavior described is as designed, and is new in 2.0.&lt;/p&gt;

&lt;p&gt;Because the index is multikey, we cannot constrain the index on both upper and lower bounds.  Instead, only one of the bounds is chosen.  This is so we can return correct matches in cases like the following:&lt;/p&gt;

&lt;p&gt;save &lt;/p&gt;
{a:[1,10]}
&lt;p&gt;query {a:{$gt:2,$lt:9}}&lt;/p&gt;

&lt;p&gt;The document should be returned because both query criteria ($gt and $lt) match a value in the a array, but if we were to use both upper and lower index bounds we would not find this document using the index.&lt;/p&gt;

&lt;p&gt;Right now if you want to do an index scan with both upper and lower bounds, you need to use a non multi key index.&lt;/p&gt;

&lt;p&gt;At some point we may implement tighter index bounds for the related elemMatch query, potentially as part of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1264&quot; title=&quot;$elemMatch on subArray&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1264&quot;&gt;&lt;del&gt;SERVER-1264&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There is some additional discussion here: &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;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                                        </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 27 Oct 2011 06:34:31 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 26 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>ian@mongodb.com</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>aaron</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>jack_xu</customfieldvalue>
            <customfieldvalue>kbanker</customfieldvalue>
            <customfieldvalue>sergejs.degtjars@abcsoftware.lv</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hron3z:</customfieldvalue>

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

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

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