<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:12:37 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-26598] conditionally push $match before $addFields in aggregation pipeline</title>
                <link>https://jira.mongodb.org/browse/SERVER-26598</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;$addFields is a new stage for 3.4 for aggregation and the same optimization that was made for some $project in &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-19153&quot; title=&quot;Conditionally push $match before $project&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-19153&quot;&gt;&lt;del&gt;SERVER-19153&lt;/del&gt;&lt;/a&gt; should be made for $addFields.&lt;/p&gt;

&lt;p&gt;(i.e. if $match is not on fields that are created/involved in $addFields then it can go before $addFields).&lt;/p&gt;</description>
                <environment></environment>
        <key id="323050">SERVER-26598</key>
            <summary>conditionally push $match before $addFields in aggregation pipeline</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="9">Done</resolution>
                                        <assignee username="kyle.suarez@mongodb.com">Kyle Suarez</assignee>
                                    <reporter username="asya.kamsky@mongodb.com">Asya Kamsky</reporter>
                        <labels>
                            <label>bkp</label>
                    </labels>
                <created>Wed, 12 Oct 2016 15:11:49 +0000</created>
                <updated>Thu, 10 May 2018 17:26:58 +0000</updated>
                            <resolved>Thu, 19 Jan 2017 19:33:04 +0000</resolved>
                                                    <fixVersion>3.5.2</fixVersion>
                                    <component>Aggregation Framework</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="1480605" author="kyle.suarez" created="Thu, 19 Jan 2017 19:33:04 +0000"  >&lt;p&gt;I&apos;m marking documentation changes as &quot;Needed&quot;, in case we want to list this under our &lt;a href=&quot;https://docs.mongodb.com/manual/core/aggregation-pipeline-optimization/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Aggregation Pipeline Optimizations page&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="1480602" author="xgen-internal-githook" created="Thu, 19 Jan 2017 19:31:38 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;username&apos;: u&apos;ksuarz&apos;, u&apos;name&apos;: u&apos;Kyle Suarez&apos;, u&apos;email&apos;: u&apos;kyle.suarez@mongodb.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-26598&quot; title=&quot;conditionally push $match before $addFields in aggregation pipeline&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-26598&quot;&gt;&lt;del&gt;SERVER-26598&lt;/del&gt;&lt;/a&gt; only report computed paths as modified in $addFields&lt;/p&gt;

&lt;p&gt;This allows a $match to be pushed before $addFields if there are no conflicts between the paths&lt;br/&gt;
involved in each stage.&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo/commit/a96a5f24604be4a9d23ec935faeba591c91f137d&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo/commit/a96a5f24604be4a9d23ec935faeba591c91f137d&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1407794" author="asya" created="Thu, 13 Oct 2016 18:59:25 +0000"  >&lt;p&gt;Moved request to reorder $sort into related &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-26442&quot; title=&quot;Push $sort before $project and $addFields&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-26442&quot;&gt;SERVER-26442&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="1407507" author="charlie.swanson" created="Thu, 13 Oct 2016 15:18:45 +0000"  >&lt;p&gt;This was thought to be challenging and/or confusing in the initial implementation of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-19153&quot; title=&quot;Conditionally push $match before $project&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-19153&quot;&gt;&lt;del&gt;SERVER-19153&lt;/del&gt;&lt;/a&gt;, but there might be a way to do this that isn&apos;t terrible. In my mind, the ideal way to do this would involve &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-25510&quot; title=&quot;Differentiate between Inclusion and Computed projections.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-25510&quot;&gt;SERVER-25510&lt;/a&gt;, splitting the functionality of &apos;including&apos; and &apos;computing&apos; into two separate classes. But that&apos;s a lot more work. If we still want this and don&apos;t want to invest in that refactor, we could add another method to &lt;tt&gt;InclusionNode&lt;/tt&gt; that would be used only for $addFields. The existing &lt;a href=&quot;https://github.com/mongodb/mongo/blob/4976eb401b3f16482fb35287ea60d7e8b33fe76d/src/mongo/db/pipeline/parsed_inclusion_projection.h#L124-L127&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;InclusionNode::addPreservedPaths()&lt;/tt&gt;&lt;/a&gt; only examines the pure inclusions, and ignores the computed fields. Thus, it can only be used by the $project stage to determine which fields are &lt;b&gt;unmodified&lt;/b&gt;. We could add a new method, maybe something like &lt;tt&gt;InclusionNode::getComputedPaths()&lt;/tt&gt; which would report all paths &lt;b&gt;explicitly&lt;/b&gt; modified by the inclusion projection. This could be called by $addFields, allowing it to take part in the $match swapping optimization.&lt;/p&gt;

&lt;p&gt;The downside to this is it leaves InclusionNode even more muddled, with &lt;tt&gt;addPreservedPaths()&lt;/tt&gt; which should only be called by $project (though is not incorrect to call from elsewhere), and &lt;tt&gt;getComputedPaths()&lt;/tt&gt; which should only be called by $addFields, but is actually incorrect (or at least dangerously misleading) to call in the event that the InclusionNode tree represents &lt;b&gt;both&lt;/b&gt; inclusions and computed paths (e.g. within a $project), since it will ignore all included paths.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10420">
                    <name>Backports</name>
                                            <outwardlinks description="backported by">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10320">
                    <name>Documented</name>
                                                                <inwardlinks description="is documented by">
                                        <issuelink>
            <issuekey id="347078">DOCS-9798</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="213329">SERVER-19153</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="307660">SERVER-25510</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>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12450" key="com.atlassian.jira.plugin.system.customfieldtypes:multicheckboxes">
                        <customfieldname>Backport Requested</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="14340"><![CDATA[v3.4]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_13552" key="com.go2group.jira.plugin.crm:crm_generic_field">
                        <customfieldname>Case</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[[500A000000aNnozIAC]]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Thu, 13 Oct 2016 15:18:45 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        7 years, 3 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_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>PM-613</customfieldvalue>
                        </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>kay.kim@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            7 years, 3 weeks, 6 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>charlie.swanson@mongodb.com</customfieldvalue>
            <customfieldvalue>xgen-internal-githook</customfieldvalue>
            <customfieldvalue>kyle.suarez@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrjtiv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hsru3r:</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_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1438">Query 2017-01-23</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|hrj6l3:</customfieldvalue>

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