<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:59:23 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-22104] $instr function to locate position of a &quot;pattern&quot; within a &quot;string&quot;</title>
                <link>https://jira.mongodb.org/browse/SERVER-22104</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;This would be a corollary to the $substr operator.  I have a case where a user would like to $project a portion of the document (i.e. 200 characters) surrounding a search string to present context to the client without having to do so in the application (because that would require sending the entire document result set back to the client).&lt;/p&gt;

&lt;p&gt;This would make MongoDB a more viable product for their use-case.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.mongodb.org/manual/reference/operator/aggregation/#string-operators&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://docs.mongodb.org/manual/reference/operator/aggregation/#string-operators&lt;/a&gt;&lt;/p&gt;</description>
                <environment></environment>
        <key id="246306">SERVER-22104</key>
            <summary>$instr function to locate position of a &quot;pattern&quot; within a &quot;string&quot;</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</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="3">Duplicate</resolution>
                                        <assignee username="backlog-server-query">Backlog - Query Team</assignee>
                                    <reporter username="shakir.sadikali@mongodb.com">Shakir Sadikali</reporter>
                        <labels>
                            <label>expression</label>
                    </labels>
                <created>Fri, 8 Jan 2016 14:24:20 +0000</created>
                <updated>Tue, 6 Dec 2022 04:36:25 +0000</updated>
                            <resolved>Mon, 27 Feb 2017 18:46:43 +0000</resolved>
                                                                    <component>Aggregation Framework</component>
                                        <votes>0</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="1510512" author="charlie.swanson" created="Mon, 27 Feb 2017 18:46:43 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=shakir.sadikali&quot; class=&quot;user-hover&quot; rel=&quot;shakir.sadikali&quot;&gt;shakir.sadikali&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Yes, we are trying to avoid extending the find projection language. Aggregation&apos;s projection language already vastly exceeds the capabilities of the find projection language, and we have added many new expressions to the aggregation language without also adding them to the find projection language. We acknowledge that moving from the find command to the aggregate command may involve a drop in performance, but we are hoping to address this shortcoming in the coming release.&lt;/p&gt;

&lt;p&gt;If the customer would be willing to adjust their query to use the new operator as requested, it doesn&apos;t seem overly onerous to request them to change their find into an aggregate instead. If this approach turns out to be slower/less efficient than the existing query, I unfortunately can&apos;t give any other advice than to wait for the performance of the aggregate command to catch up to that of the find command. &lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Charlie&lt;/p&gt;</comment>
                            <comment id="1502323" author="shakir.sadikali" created="Fri, 17 Feb 2017 17:50:51 +0000"  >&lt;p&gt;They are running &lt;tt&gt;find&lt;/tt&gt; commands.  Is there a reason we want to force users into using the aggregation framework for relatively trivial queries?&lt;/p&gt;</comment>
                            <comment id="1145540" author="charlie.swanson" created="Fri, 15 Jan 2016 20:44:09 +0000"  >&lt;p&gt;Okay, thanks for clarifying. I&apos;m still going to close this as a duplicate, since it seems like you are requesting the same functionality as &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8951&quot; title=&quot;Add $findChar or $indexOf operator for strings to find position of specific character (or substring)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8951&quot;&gt;&lt;del&gt;SERVER-8951&lt;/del&gt;&lt;/a&gt;, plus a bit more customization. I&apos;ve added a comment to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8951&quot; title=&quot;Add $findChar or $indexOf operator for strings to find position of specific character (or substring)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8951&quot;&gt;&lt;del&gt;SERVER-8951&lt;/del&gt;&lt;/a&gt; reflecting the other options you would like, so they will be taken into consideration when we design and implement &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8951&quot; title=&quot;Add $findChar or $indexOf operator for strings to find position of specific character (or substring)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8951&quot;&gt;&lt;del&gt;SERVER-8951&lt;/del&gt;&lt;/a&gt;. Thanks!&lt;/p&gt;</comment>
                            <comment id="1145303" author="shakir.sadikali" created="Fri, 15 Jan 2016 18:00:42 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=charlie.swanson&quot; class=&quot;user-hover&quot; rel=&quot;charlie.swanson&quot;&gt;charlie.swanson&lt;/a&gt; Perhaps?  I&apos;m looking for the equivalent of the Oracle (gasp) &lt;a href=&quot;https://docs.oracle.com/cd/B19306_01/server.102/b14200/functions068.htm&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;INSTR&lt;/a&gt; function.  The usecase is a simple one, i pass in STRING, SUBSTR, OCCURENCE and it returns the starting index of SUBSTR within STRING at OCCURENCE of SUBSTR.  In practice, i would use INSTR and SUBSTR together to parse out portions of text from other strings.  I re-opened because I wasn&apos;t sure what the protocol is.  If you deem this to be a dup, please close and accept my apologies.&lt;/p&gt;</comment>
                            <comment id="1145089" author="charlie.swanson" created="Fri, 15 Jan 2016 15:26:42 +0000"  >&lt;p&gt;Yes, I believe this is a duplicate. &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=shakir.sadikali&quot; class=&quot;user-hover&quot; rel=&quot;shakir.sadikali&quot;&gt;shakir.sadikali&lt;/a&gt;, please elaborate on the differences if you there are any. I&apos;ll close this as a duplicate in the meantime.&lt;/p&gt;</comment>
                            <comment id="1135674" author="asya" created="Fri, 15 Jan 2016 04:22:13 +0000"  >&lt;p&gt;This is dup of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-8951&quot; title=&quot;Add $findChar or $indexOf operator for strings to find position of specific character (or substring)&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-8951&quot;&gt;&lt;del&gt;SERVER-8951&lt;/del&gt;&lt;/a&gt; no?&lt;/p&gt;</comment>
                            <comment id="1129695" author="charlie.swanson" created="Fri, 8 Jan 2016 15:56:19 +0000"  >&lt;p&gt;Ah, okay. Yes, that very well may be the case. I investigated it a bit some time ago, and it looks like both python and javascript support extracting the position of the match (javascript example &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;). So I think it is possible.&lt;/p&gt;

&lt;p&gt;Anyway, I think your request to have a separate expression just to get the index of an exact string match is a reasonable one, especially if the &lt;tt&gt;$regex&lt;/tt&gt; syntax ends up being convoluted. I&apos;ll leave this open and report back when we decide on the syntax/features of a &lt;tt&gt;$regex&lt;/tt&gt; expression.&lt;/p&gt;</comment>
                            <comment id="1129677" author="shakir.sadikali" created="Fri, 8 Jan 2016 15:44:01 +0000"  >&lt;p&gt;I was looking at regex documentation for linux / bash specifically.  It does not support returning a specific position (as far as could find).  If we were to implement such functionality it would deviate from the general behavior out in the wild (again, I&apos;ll be the first to admit I&apos;m a regex novice and could have easily missed something).&lt;/p&gt;</comment>
                            <comment id="1129654" author="charlie.swanson" created="Fri, 8 Jan 2016 15:26:33 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=shakir.sadikali&quot; class=&quot;user-hover&quot; rel=&quot;shakir.sadikali&quot;&gt;shakir.sadikali&lt;/a&gt;, can you point me to the reading you&apos;ve referenced? We haven&apos;t fully specified what a &lt;tt&gt;$regex&lt;/tt&gt; expression would do, were we to make one, but I&apos;m surprised by your assertion that it can&apos;t return the index of any matches, and curious why this is the case.&lt;/p&gt;</comment>
                            <comment id="1129618" author="shakir.sadikali" created="Fri, 8 Jan 2016 14:48:04 +0000"  >&lt;p&gt;It could be a viable solution if we could combine $substr and $regex (assuming regex can return the position, but all the reading I&apos;ve done suggests that it can&apos;t) within the aggregation framework.  However, for consistency and simplicity, having $instr as a companion function to $substr seems to make sense.  Is there any additional information I can provide?&lt;/p&gt;</comment>
                            <comment id="1129615" author="charlie.swanson" created="Fri, 8 Jan 2016 14:42:30 +0000"  >&lt;p&gt;This is related to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11947&quot; title=&quot;Add a regex expression to the aggregation language&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-11947&quot;&gt;&lt;del&gt;SERVER-11947&lt;/del&gt;&lt;/a&gt;. Depending on how that gets resolved, it could potentially address this use case. For example, if there was a &lt;tt&gt;$regex&lt;/tt&gt;-like expression that could return the position in the string which it found the match, it could be used (in combination with &lt;tt&gt;$substr&lt;/tt&gt;) to achieve this. I won&apos;t mark as an explicit duplicate though, since &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11947&quot; title=&quot;Add a regex expression to the aggregation language&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-11947&quot;&gt;&lt;del&gt;SERVER-11947&lt;/del&gt;&lt;/a&gt; could be resolved without addressing this use case, or vice versa.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="68110">SERVER-8951</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="101071">SERVER-11947</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>11.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25143"><![CDATA[Query]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000WTsDaIAL]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Fri, 8 Jan 2016 14:42:30 +0000</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            6 years, 50 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-query</customfieldvalue>
            <customfieldvalue>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>shakir.sadikali@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrkl2f:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsfb7r:</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_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|hrjdif:</customfieldvalue>

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