<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:37:24 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-15235] Regex query returns incorrect results when index is present</title>
                <link>https://jira.mongodb.org/browse/SERVER-15235</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;We&apos;ve noticed a strange issue where a regex query on a field returns different results, depending on whether there is an index defined on that field or not.&lt;/p&gt;

&lt;p&gt;I&apos;ve included a JS test file (&lt;tt&gt;regex_different_results_with_index.js&lt;/tt&gt;) which reproduces the issue.&lt;/p&gt;

&lt;p&gt;The regex is left-anchored. Also, an equavilent regex expression (included in JS) works in both cases:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;&lt;tt&gt;/^(a(a|$)|b)/&lt;/tt&gt; : works both with and without index&lt;/li&gt;
	&lt;li&gt;&lt;tt&gt;/^a(a|$)|^b/&lt;/tt&gt; : works without an index, does not work with an index&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Looking at the regex expression, the result without the index (both &quot;aa&quot; and &quot;bb&quot; match) should be the correct one. When the index is present, only &quot;aa&quot; is returned, which is incorrect.&lt;/p&gt;

&lt;p&gt;I have tested this on 2.4.11 and 2.6.3.&lt;/p&gt;</description>
                <environment></environment>
        <key id="157845">SERVER-15235</key>
            <summary>Regex query returns incorrect results when index is present</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="david.storch@mongodb.com">David Storch</assignee>
                                    <reporter username="victor.hooi">Victor Hooi</reporter>
                        <labels>
                    </labels>
                <created>Fri, 12 Sep 2014 08:34:17 +0000</created>
                <updated>Mon, 11 Jul 2016 17:18:12 +0000</updated>
                            <resolved>Wed, 12 Nov 2014 20:42:04 +0000</resolved>
                                    <version>2.4.11</version>
                    <version>2.6.3</version>
                    <version>2.7.6</version>
                                    <fixVersion>2.8.0-rc1</fixVersion>
                                    <component>Querying</component>
                                        <votes>1</votes>
                                    <watches>8</watches>
                                                                                                                <comments>
                            <comment id="1191686" author="ramon.fernandez" created="Thu, 3 Mar 2016 12:03:44 +0000"  >&lt;p&gt;Thanks for opening a new ticket &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=itwebtf%40saxobank.com&quot; class=&quot;user-hover&quot; rel=&quot;itwebtf@saxobank.com&quot;&gt;itwebtf@saxobank.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The 2.8 release was renamed 3.0, so anything with a 2.8.0-rc0 fixVersion is included in all 3.x versions.&lt;/p&gt;</comment>
                            <comment id="1191548" author="itwebtf@saxobank.com" created="Thu, 3 Mar 2016 07:55:34 +0000"  >&lt;p&gt;Hi Ramon,&lt;/p&gt;

&lt;p&gt;This ticket is market with 2.8.0-rc0, but I know it is in 3.x releases.Could you inform me about what exact 3.x release this bug fix went into?&lt;/p&gt;

&lt;p&gt;I have created a new ticket &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-22939&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;SERVER-22939&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Brian&lt;/p&gt;</comment>
                            <comment id="1191340" author="ramon.fernandez" created="Thu, 3 Mar 2016 00:58:29 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=itwebtf%40saxobank.com&quot; class=&quot;user-hover&quot; rel=&quot;itwebtf@saxobank.com&quot;&gt;itwebtf@saxobank.com&lt;/a&gt;, this fix was published in a release, so in order to avoid confusion we need a new ticket if you think this behavior needs to change. If you feel none of the ones you&apos;ve opened already are good candidates please feel free to open a new one.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                            <comment id="1190107" author="itwebtf@saxobank.com" created="Wed, 2 Mar 2016 10:04:45 +0000"  >&lt;p&gt;This must be reopened.&lt;/p&gt;

&lt;p&gt;The problem with this fix is that, even when I have a regular expression that has a left-anchor and an escaped &apos;|&apos; character, that query is recognized as being &quot;non-simple&quot;. &lt;/p&gt;

&lt;p&gt;This is wrong, and it causes unnecessarily that backwards compatibility is broken and performance is significantly degraded. See &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-22872?focusedCommentId=1188778&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1188778&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;SERVER-22872&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-22890?focusedCommentId=1188752&amp;amp;page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1188752&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;SERVER-22890&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="762739" author="xgen-internal-githook" created="Wed, 12 Nov 2014 20:39:45 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;dstorch&apos;, u&apos;name&apos;: u&apos;David Storch&apos;, u&apos;email&apos;: u&apos;david.storch@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-15235&quot; title=&quot;Regex query returns incorrect results when index is present&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-15235&quot;&gt;&lt;del&gt;SERVER-15235&lt;/del&gt;&lt;/a&gt; regular expressions with the &apos;|&apos; character must be classified as simple&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/866d3851fcb7a6b230cb2fde7b2a6253ba32eeb5&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/866d3851fcb7a6b230cb2fde7b2a6253ba32eeb5&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="754743" author="rassi@10gen.com" created="Mon, 3 Nov 2014 17:32:57 +0000"  >&lt;p&gt;No.&lt;/p&gt;

&lt;p&gt;This issues exposes a bug in the code that parses regular expression query predicates to generate index bounds, for regular expressions that have multiple left-anchor subexpressions joined by an OR.  In the example expression /&amp;#94;a&amp;#40;a&amp;#124;$)&amp;#124;&amp;#94;b/, the index bounds [&quot;a&quot;, &quot;b&quot;) are generated, which causes the query to miss all documents that start with &apos;b&apos;.  The problem is that the parser looks at the the first two characters (&apos;^&apos; and then &apos;a&apos;), and then incorrectly stops at the third character (the left paren) and reports that the regular expression is a left-anchored expression with prefix &quot;a&quot;.&lt;/p&gt;</comment>
                            <comment id="754705" author="tjrobinson" created="Mon, 3 Nov 2014 17:11:18 +0000"  >&lt;p&gt;Could this issue be related: &lt;a href=&quot;http://stackoverflow.com/questions/26631352/can-i-do-a-mongodb-starts-with-query-on-an-indexed-subdocument-field/26635039?noredirect=1#comment41905713_26635039&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/questions/26631352/can-i-do-a-mongodb-starts-with-query-on-an-indexed-subdocument-field/26635039?noredirect=1#comment41905713_26635039&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="120470">SERVER-13199</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="229979">SERVER-20432</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="268318">SERVER-22872</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="268718">SERVER-22890</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="175660">SERVER-16622</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="52023" name="regex_different_results_with_index.js" size="768" author="victor.hooi" created="Fri, 12 Sep 2014 08:34:17 +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>Thu, 25 Sep 2014 19:33:26 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            7 years, 49 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10249"><![CDATA[Cannot]]></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>david.storch@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>itwebtf@saxobank.com</customfieldvalue>
            <customfieldvalue>rassi</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
            <customfieldvalue>tjrobinson</customfieldvalue>
            <customfieldvalue>victor.hooi</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrlo2n:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>137370</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10750" key="com.atlassian.jira.plugin.system.customfieldtypes:textarea">
                        <customfieldname>Steps To Reproduce</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>&lt;p&gt;See &lt;tt&gt;regex_different_results_with_index.js&lt;/tt&gt;&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|hrnmgv:</customfieldvalue>

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