<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:48:21 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-38235] sort order on multi key index queries not as expected</title>
                <link>https://jira.mongodb.org/browse/SERVER-38235</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I have a system which stores documents that have an array valued field which contains pairs of metric names and values. I also have a compound index on this field which should enable querying for all documents containing a metric with a given name and returning them sorted by metric value. However, it looks like sorting works correctly only of the first element of the array.&lt;/p&gt;

&lt;p&gt;I&apos;m pretty sure it did work as expected in previous MongoDB versions, but I&apos;m not sure when it stopped working.&lt;/p&gt;

&lt;p&gt;I did work around the issue using the aggregation framework to get the correct sorting, but this has slowed down queries a lot.&lt;/p&gt;</description>
                <environment></environment>
        <key id="637827">SERVER-38235</key>
            <summary>sort order on multi key index queries not as expected</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="13202">Works as Designed</resolution>
                                        <assignee username="daniel.hatcher@mongodb.com">Danny Hatcher</assignee>
                                    <reporter username="skaes">Stefan Kaes</reporter>
                        <labels>
                    </labels>
                <created>Sat, 24 Nov 2018 08:44:38 +0000</created>
                <updated>Fri, 27 Oct 2023 13:53:24 +0000</updated>
                            <resolved>Wed, 26 Dec 2018 19:15:09 +0000</resolved>
                                    <version>3.6.8</version>
                    <version>4.0.4</version>
                                                    <component>Index Maintenance</component>
                    <component>Querying</component>
                    <component>WiredTiger</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="2100410" author="daniel.hatcher" created="Wed, 26 Dec 2018 19:14:59 +0000"  >&lt;p&gt;Hello Stefan,&lt;/p&gt;

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

&lt;p&gt;I&apos;m glad to hear that you were able to resolve your issue.&lt;/p&gt;

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

&lt;p&gt;Thank you,&lt;/p&gt;

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

&lt;p&gt;Danny&lt;/p&gt;</comment>
                            <comment id="2099195" author="skaes" created="Sat, 22 Dec 2018 11:48:13 +0000"  >&lt;p&gt;You can close this ticket.&lt;/p&gt;</comment>
                            <comment id="2099193" author="skaes" created="Sat, 22 Dec 2018 11:47:52 +0000"  >&lt;p&gt;Hello Daniel,&lt;/p&gt;

&lt;p&gt;thx for your help and the information provided.&lt;/p&gt;

&lt;p&gt;I solved my problem by writing a separate metrics collection which has an entry for every metric in the original document. This more or less reduces the original collection to a KV/store.&lt;/p&gt;</comment>
                            <comment id="2072741" author="daniel.hatcher" created="Tue, 27 Nov 2018 15:06:46 +0000"  >&lt;p&gt;Hello Stefan,&lt;/p&gt;

&lt;p&gt;I&apos;m sorry to hear that. The current expectation is for us to end-of-life the 3.4 series in &lt;a href=&quot;https://www.mongodb.com/support-policy&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;June 2019&lt;/a&gt;. At that point we would stop releasing bug fixes via minor releases but of course you are welcome to keep using the software past that date.&lt;/p&gt;

&lt;p&gt;Do you have an example of some of your documents and the queries that you are trying to run against them? There may be some quick wins that we can recommend that would improve their performance regardless of the index sorting change. Please note that this is a public project so do not post anything that would be considered private.&lt;/p&gt;

&lt;p&gt;Thank you very much,&lt;/p&gt;

&lt;p&gt;Daniel Hatcher&lt;/p&gt;</comment>
                            <comment id="2072633" author="skaes" created="Tue, 27 Nov 2018 13:04:57 +0000"  >&lt;p&gt;BTW, I think adding an explanation to the user manual on how indexes on array fields work would be quite an improvement.&lt;/p&gt;</comment>
                            <comment id="2072565" author="skaes" created="Tue, 27 Nov 2018 10:32:06 +0000"  >&lt;p&gt;Hi Danny,&lt;/p&gt;

&lt;p&gt;thx for the quick response. I have checked my code against version 3.4.18 and it works fine. Seems like this change is exactly what caused my problems. Unfortunately, this makes my indexes relatively useless, even though index contains all entries in the required order. Some of my collections using this kind of index are rather large and therefore queries have become really slow. I will have to consider either staying on 3.4 or switching to some other database technology.&lt;/p&gt;</comment>
                            <comment id="2072171" author="daniel.hatcher" created="Mon, 26 Nov 2018 22:07:53 +0000"  >&lt;p&gt;Hello Stefan,&lt;/p&gt;

&lt;p&gt;In 3.6, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-19402&quot; title=&quot;Change semantics of sorting by array fields in find and aggregate&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-19402&quot;&gt;&lt;del&gt;SERVER-19402&lt;/del&gt;&lt;/a&gt; changed the way that sorting by an array field works. This was known to change sort results for some applications but it was determined that the benefits outweighed the downsides. Do you believe that you are being affected something other than the changes in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-19402&quot; title=&quot;Change semantics of sorting by array fields in find and aggregate&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-19402&quot;&gt;&lt;del&gt;SERVER-19402&lt;/del&gt;&lt;/a&gt;?&lt;/p&gt;

&lt;p&gt;Thank you,&lt;/p&gt;

&lt;p&gt;Danny&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="201781" name="test.js" size="388" author="skaes" created="Sat, 24 Nov 2018 08:44:00 +0000"/>
                    </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>Sat, 24 Nov 2018 17:36:32 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            5 years, 7 weeks ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10032" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Operating System</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10026"><![CDATA[ALL]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>daniel.hatcher@mongodb.com</customfieldvalue>
            <customfieldvalue>skaes</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hudk4v:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hu3orb:</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_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;Please run the attached script. It returns the documents in reverse order to what is expected.&lt;/p&gt;</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

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

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