<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:09:34 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-5672] Natural Sort ignores Index</title>
                <link>https://jira.mongodb.org/browse/SERVER-5672</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;db.log.find(&lt;/p&gt;
{ rf : &apos;o-5556457634&apos;}
&lt;p&gt;).sort(&lt;/p&gt;
{ &apos;$natural&apos; : -1 }
&lt;p&gt;).explain();&lt;br/&gt;
{&lt;br/&gt;
&quot;cursor&quot; : &quot;ReverseCappedCursor&quot;,&lt;br/&gt;
&quot;nscanned&quot; : 1654468,&lt;br/&gt;
&quot;nscannedObjects&quot; : 1654468,&lt;br/&gt;
&quot;n&quot; : 4,&lt;br/&gt;
&quot;millis&quot; : 2932,&lt;br/&gt;
&quot;nYields&quot; : 5,&lt;br/&gt;
&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
&quot;isMultiKey&quot; : false,&lt;br/&gt;
&quot;indexOnly&quot; : false,&lt;br/&gt;
&quot;indexBounds&quot; : {}&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;Without the &apos;natural&apos; sort:&lt;/p&gt;

&lt;p&gt;db.log.find(&lt;/p&gt;
{ rf : &apos;o-5556457634&apos;}
&lt;p&gt;).explain();&lt;br/&gt;
{&lt;br/&gt;
&quot;cursor&quot; : &quot;BtreeCursor rf_1&quot;,&lt;br/&gt;
&quot;nscanned&quot; : 4,&lt;br/&gt;
&quot;nscannedObjects&quot; : 4,&lt;br/&gt;
&quot;n&quot; : 4,&lt;br/&gt;
&quot;millis&quot; : 0,&lt;br/&gt;
&quot;nYields&quot; : 0,&lt;br/&gt;
&quot;nChunkSkips&quot; : 0,&lt;br/&gt;
&quot;isMultiKey&quot; : false,&lt;br/&gt;
&quot;indexOnly&quot; : false,&lt;br/&gt;
&quot;indexBounds&quot; : {&lt;br/&gt;
    &quot;rf&quot; : [&lt;br/&gt;
        [&lt;br/&gt;
            &quot;o-5556457634&quot;,&lt;br/&gt;
            &quot;o-5556457634&quot;&lt;br/&gt;
        ]&lt;br/&gt;
    ]&lt;br/&gt;
}&lt;/p&gt;</description>
                <environment>Capped Collection / &amp;#39;rf&amp;#39; is sparse-indexed</environment>
        <key id="36832">SERVER-5672</key>
            <summary>Natural Sort ignores Index</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="-1">Unassigned</assignee>
                                    <reporter username="userman99">Diego Maxi</reporter>
                        <labels>
                    </labels>
                <created>Fri, 20 Apr 2012 22:28:30 +0000</created>
                <updated>Sun, 5 Jan 2014 09:10:52 +0000</updated>
                            <resolved>Fri, 20 Apr 2012 22:39:58 +0000</resolved>
                                    <version>2.0.4</version>
                                                    <component>Index Maintenance</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="113172" author="userman99" created="Tue, 24 Apr 2012 16:00:51 +0000"  >&lt;p&gt;MongoDB seems to be a perfect solution to store large sets of application logs; and occasionally, I need to retrieve some of them (could be based on user_ip, user_id, log_type, etc). On those cases I need the resulting list to be sorted in reverse chronological order. Will give it a shot on the user group. Thanks!&lt;/p&gt;</comment>
                            <comment id="112981" author="eliot" created="Tue, 24 Apr 2012 05:05:19 +0000"  >&lt;p&gt;What are you trying to do exactly?&lt;br/&gt;
Do you really care about on disk order or are you trying to simulate something else?&lt;br/&gt;
This discussion is probably better suited for &lt;a href=&quot;http://groups.google.com/group/mongodb-user/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/&lt;/a&gt; as there are standard solutions, just want to make sure to give you the right one &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="112980" author="eliot" created="Tue, 24 Apr 2012 05:05:18 +0000"  >&lt;p&gt;What are you trying to do exactly?&lt;br/&gt;
Do you really care about on disk order or are you trying to simulate something else?&lt;br/&gt;
This discussion is probably better suited for &lt;a href=&quot;http://groups.google.com/group/mongodb-user/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/&lt;/a&gt; as there are standard solutions, just want to make sure to give you the right one &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="112621" author="userman99" created="Mon, 23 Apr 2012 15:34:12 +0000"  >&lt;p&gt;What about reverse natural sort on a query like this? &lt;br/&gt;
db.log.find({type: {$gte: 100}}); &lt;br/&gt;
I&apos;m trying understand what&apos;s the &apos;recommended&apos; method to do (reverse) natural sorting on an application with dynamic querying. Do I need to modify the sort based on the query? Do I have to implement/index an auto-increment or microtime field? Thanks again!&lt;/p&gt;</comment>
                            <comment id="112247" author="eliot" created="Sat, 21 Apr 2012 12:16:03 +0000"  >&lt;p&gt;db.log.find(&lt;/p&gt;
{ rf : &apos;o-5556457634&apos;}
&lt;p&gt;).sort ( &lt;/p&gt;
{ rf : -1 }
&lt;p&gt; )&lt;/p&gt;</comment>
                            <comment id="112222" author="userman99" created="Sat, 21 Apr 2012 03:10:20 +0000"  >&lt;p&gt;The problem is that I need the results in reverse disk order. Do I have any way to accomplish this without creating additional fields? thanks!&lt;/p&gt;</comment>
                            <comment id="112221" author="eliot" created="Sat, 21 Apr 2012 03:02:37 +0000"  >&lt;p&gt;When you sort via an index, if the keys are dups, then the sort is disk order.  So you don&apos;t need to do anything special.&lt;/p&gt;</comment>
                            <comment id="112220" author="userman99" created="Sat, 21 Apr 2012 02:59:09 +0000"  >&lt;p&gt;So the only way to accomplish this is by creating and indexing an additional custom field just for this task? Haven&apos;s seen any mention about this logic in the documentation and I thought the engine was able to look at the order on disk after getting the results (assuming the &apos;find&apos; results will carry the disk order internally). Thanks.&lt;/p&gt;</comment>
                            <comment id="112191" author="eliot" created="Fri, 20 Apr 2012 22:39:58 +0000"  >&lt;p&gt;That&apos;s what $natural is supposed to do.&lt;br/&gt;
It forces a table scan to return them in the order they are on disk.&lt;br/&gt;
When doing a query, you shouldn&apos;t use $natural&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="65660">SERVER-8607</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 20 Apr 2012 22:39:58 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 43 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, 43 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="10020"><![CDATA[Linux]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>userman99</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hro553:</customfieldvalue>

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

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

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