<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:15:04 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-7621] Missing operator to compare two fields in aggregation framework query</title>
                <link>https://jira.mongodb.org/browse/SERVER-7621</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;There doesn&apos;t seem to be a way to include a $match condition that compares two fields eg to include all documents where field1 == field2:&lt;/p&gt;

&lt;p&gt;    { &quot;$match&quot; : { &quot;$field1&quot; : { &quot;$eq&quot; : &quot;$field2&quot;}} }&lt;/p&gt;

&lt;p&gt;We can only use operators that compare a field against values.&lt;/p&gt;

&lt;p&gt;$where is no longer allowed in aggregate framework queries, so one cannot use arbitrary javascript to achieve this.&lt;/p&gt;</description>
                <environment></environment>
        <key id="55978">SERVER-7621</key>
            <summary>Missing operator to compare two fields in aggregation framework query</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</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="3">Duplicate</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="joe.davis@servicenow.com">Joe Davis</reporter>
                        <labels>
                    </labels>
                <created>Mon, 12 Nov 2012 00:02:12 +0000</created>
                <updated>Fri, 15 Feb 2013 15:05:42 +0000</updated>
                            <resolved>Mon, 12 Nov 2012 01:18:20 +0000</resolved>
                                                                    <component>Aggregation Framework</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="186149" author="joe.davis@servicenow.com" created="Mon, 12 Nov 2012 06:03:30 +0000"  >&lt;p&gt;Aaron - that&apos;s rad.  Thanks for pointing that out.  Lesson learned, read the code.&lt;/p&gt;</comment>
                            <comment id="186122" author="aaron" created="Mon, 12 Nov 2012 05:27:39 +0000"  >&lt;p&gt;Joe - you can use the same $project strategy with any of the aggregation expressions.  &amp;lt;&lt;a href=&quot;http://docs.mongodb.org/manual/reference/aggregation/#expressions&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://docs.mongodb.org/manual/reference/aggregation/#expressions&lt;/a&gt;&amp;gt;&lt;/p&gt;</comment>
                            <comment id="186116" author="joe.davis@servicenow.com" created="Mon, 12 Nov 2012 05:21:26 +0000"  >&lt;p&gt;Eliot - awesome that would be great.&lt;/p&gt;

&lt;p&gt;Aaron - thanks for the info.  I&apos;ll try it out, wonder if that works for other operators besides $eq though, as I&apos;m looking for less than, less than equals, greater than, etc. as well.&lt;/p&gt;

&lt;p&gt;Thanks again all, looking forward to the expression based filters.&lt;/p&gt;</comment>
                            <comment id="186090" author="eliot" created="Mon, 12 Nov 2012 04:46:04 +0000"  >&lt;p&gt;Sorry, should&apos;ve explained more.&lt;br/&gt;
There is another case (I&apos;ll try to dig it up, but made &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-7623&quot; title=&quot;comparison operation right hand side should be expressions&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-7623&quot;&gt;&lt;del&gt;SERVER-7623&lt;/del&gt;&lt;/a&gt; as well) to make all comparison operators take expressions on the right hand side.&lt;br/&gt;
So the combination solves this both for agg and regular queries.&lt;/p&gt;</comment>
                            <comment id="186087" author="aaron" created="Mon, 12 Nov 2012 04:43:44 +0000"  >&lt;p&gt;Hi Joe,&lt;/p&gt;

&lt;p&gt;Currently what you&apos;d need to do for this is $project, then $match&lt;/p&gt;

&lt;p&gt;aggregate( { $project:{ matches:&lt;/p&gt;
{ $eq:[ &apos;$field1&apos;, &apos;$field2&apos; ] }
&lt;p&gt; } }, { $match:&lt;/p&gt;
{ matches:true }
&lt;p&gt; } )&lt;/p&gt;</comment>
                            <comment id="186082" author="joe.davis@servicenow.com" created="Mon, 12 Nov 2012 04:36:38 +0000"  >&lt;p&gt;That&apos;s cool &lt;b&gt;but has nothing to do with my issue&lt;/b&gt;.&lt;/p&gt;

&lt;p&gt;This is about a lack of operators to compare fields: eg $eg, $gte, $lte, $lt, etc.&lt;/p&gt;

&lt;p&gt;All mongo operators should be able to take fields or values as right hand side operator.  &lt;/p&gt;

&lt;p&gt;Currently, nothing allows to compare field1 against field2 (only field1 against a constant value).&lt;/p&gt;</comment>
                            <comment id="185965" author="eliot" created="Mon, 12 Nov 2012 01:18:20 +0000"  >&lt;p&gt;The agg framework uses the same query language as regular find.&lt;br/&gt;
The case for adding $eq is here: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1367&quot; title=&quot;create an $eq operator for queries that works similar to $gte and $lte&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1367&quot;&gt;&lt;del&gt;SERVER-1367&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                    <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>Mon, 12 Nov 2012 01:18:20 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 14 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>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, 14 weeks, 2 days 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_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>aaron</customfieldvalue>
            <customfieldvalue>eliot</customfieldvalue>
            <customfieldvalue>joe.davis@servicenow.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrni5r:</customfieldvalue>

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

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

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