<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:02:03 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-3089] Ability to make use of a subdocument&apos;s data whose contents were used to satisfy a query using the $ operator</title>
                <link>https://jira.mongodb.org/browse/SERVER-3089</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When performing a query against indexed subdocument fields we are able to retrieve and update the subdocument within an array using the $ operator.  There are cases where we would have need to know what subdocuments were located who satisfied our query and make use of that data.  &lt;/p&gt;

&lt;p&gt;A simple example would be to locate a document based on its subdocuments content and append a new subdocument that derives from that located subdocument...Given:&lt;/p&gt;

&lt;p&gt;{ &quot;SUBS&quot; : [ &lt;/p&gt;
        { 
                &quot;_id&quot; : 1, 
                &quot;VALUE&quot; : 5 
        } 
&lt;p&gt;], &quot;_id&quot; : 1 } &lt;/p&gt;

&lt;p&gt;Would like to execute something like:&lt;/p&gt;

&lt;p&gt;db.col.update( &lt;/p&gt;
{ &quot;SUBS._id&quot; : 1 }
&lt;p&gt;, { $push : { &quot;SUBS&quot; : &lt;/p&gt;
{ &quot;_id&quot; : 3, 
&quot;VALUE&quot; : SUBS.$.VALUE * 5 }
&lt;p&gt; } } ) &lt;/p&gt;

&lt;p&gt;That would result in appending a new subdocument &quot;_id&quot;:3 in all documents who contain the matched subdocument from our query with a new value derived from the matched subdocument:&lt;/p&gt;

&lt;p&gt;{ &quot;SUBS&quot; : [ &lt;br/&gt;
        &lt;/p&gt;
{ 
                &quot;_id&quot; : 1, 
                &quot;VALUE&quot; : 5 
        }
&lt;p&gt;,&lt;/p&gt;
        { 
                &quot;_id&quot; : 3, 
                &quot;VALUE&quot; : 25 
        }  
&lt;p&gt;], &quot;_id&quot; : 1 } &lt;/p&gt;


&lt;p&gt;Please see (&lt;a href=&quot;http://groups.google.com/group/mongodb-user/browse_thread/thread/7f0409356557aa64/468de81a1f938046?lnk=gst&amp;amp;q=serenityexperience#468de81a1f938046&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://groups.google.com/group/mongodb-user/browse_thread/thread/7f0409356557aa64/468de81a1f938046?lnk=gst&amp;amp;q=serenityexperience#468de81a1f938046&lt;/a&gt;) for full discussion.&lt;/p&gt;

&lt;p&gt;This relates to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-831&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://jira.mongodb.org/browse/SERVER-831&lt;/a&gt;, but in that case the subdocuments are being updated.  This request is for the ability to access the subdocuments content who satisfied the query so we can make further decisions/modifications based on that content.&lt;/p&gt;

&lt;p&gt;As an added advantage I could seen a lot of power added to JavaScripting if this were also available within JS, for example:&lt;/p&gt;

&lt;p&gt;function( previousID, newID ) &lt;br/&gt;
{ &lt;br/&gt;
  db.col.find( &lt;br/&gt;
    &lt;/p&gt;
{ &quot;SUBS._id&quot; : previousID }
&lt;p&gt; ).forEach( &lt;br/&gt;
      function( thing ) &lt;br/&gt;
      { &lt;br/&gt;
        previousValue = thing.SUBS.$.VALUE; &lt;br/&gt;
        db.col.update( &lt;br/&gt;
            &lt;/p&gt;
{ &quot;_id&quot;      : thing._id  }
&lt;p&gt;, &lt;br/&gt;
            { $push : { &quot;SUBS&quot; : &lt;br/&gt;
                &lt;/p&gt;
{ &quot;_id&quot;    : newID, 
                  &quot;VALUE&quot;  : previousValue * 5 }
&lt;p&gt; } } ); &lt;br/&gt;
      } ); &lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;In this case, where the primary document was queried based on its subdocument contents, it would be significant if we had access to that data through the passed in matched Document.  I am not sure if this would be the ideal syntax but having some way to reference the specific subdocument that satisfied the this outer query can give a lot of power to the inner for making decisions based on such content.&lt;/p&gt;

</description>
                <environment></environment>
        <key id="17008">SERVER-3089</key>
            <summary>Ability to make use of a subdocument&apos;s data whose contents were used to satisfy a query using the $ operator</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</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="jp777">jp</reporter>
                        <labels>
                    </labels>
                <created>Fri, 13 May 2011 03:46:40 +0000</created>
                <updated>Tue, 6 Dec 2022 05:43:47 +0000</updated>
                            <resolved>Fri, 11 Aug 2017 21:43:38 +0000</resolved>
                                                                    <component>Querying</component>
                                        <votes>24</votes>
                                    <watches>22</watches>
                                                                                                                <comments>
                            <comment id="1571636" author="asya" created="Mon, 15 May 2017 21:07:33 +0000"  >&lt;p&gt;I don&apos;t think this ticket is asking for anything that &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-11345&quot; title=&quot;Allow update to compute expressions using referenced fields like Aggregation Framework&amp;#39;s $project&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-11345&quot;&gt;&lt;del&gt;SERVER-11345&lt;/del&gt;&lt;/a&gt; wouldn&apos;t give it - fundamentally, you cannot currently refer to any &lt;b&gt;value&lt;/b&gt; in the document for the purposes of querying or updating the document.  Related tickets: &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2702&quot; title=&quot;Compare document fields in queries&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2702&quot;&gt;&lt;del&gt;SERVER-2702&lt;/del&gt;&lt;/a&gt;, &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2507&quot; title=&quot;variable field name in queries&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2507&quot;&gt;SERVER-2507&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-2549&quot; title=&quot;expression native support ,  find({ a: { $lt : b*2 } })&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-2549&quot;&gt;&lt;del&gt;SERVER-2549&lt;/del&gt;&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="32738" author="scotthernandez" created="Sat, 14 May 2011 14:56:08 +0000"  >&lt;p&gt;I believe the other piece you want will be supported by &lt;a href=&quot;http://jira.mongodb.org/browse/SERVER-828&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;http://jira.mongodb.org/browse/SERVER-828&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="11619">SERVER-831</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10010">
                    <name>Duplicate</name>
                                            <outwardlinks description="duplicates">
                                        <issuelink>
            <issuekey id="95566">SERVER-11345</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="11615">SERVER-828</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                                        </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.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_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 14 May 2011 14:56:08 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        6 years, 39 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[<s><a href='https://jira.mongodb.org/browse/SERVER-831'>SERVER-831</a></s>]]></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, 39 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>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-server-query</customfieldvalue>
            <customfieldvalue>jp777</customfieldvalue>
            <customfieldvalue>scotthernandez</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrozw7:</customfieldvalue>

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

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

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