<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:04:26 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-3920] Get object IDs for mutated objects after an update</title>
                <link>https://jira.mongodb.org/browse/SERVER-3920</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;When an update is issued which mutates objects, I would like to be able to get an array of object IDs that were changed as a result of the update.&lt;/p&gt;</description>
                <environment>Ubuntu Linux 10.04 64bit</environment>
        <key id="22646">SERVER-3920</key>
            <summary>Get object IDs for mutated objects after an update</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-query-optimization">Backlog - Query Optimization</assignee>
                                    <reporter username="ahildoer">ahildoer</reporter>
                        <labels>
                            <label>SERVER_V2</label>
                            <label>update</label>
                    </labels>
                <created>Wed, 21 Sep 2011 17:33:47 +0000</created>
                <updated>Tue, 6 Dec 2022 05:40:19 +0000</updated>
                                            <version>2.0.0</version>
                                                    <component>Write Ops</component>
                                        <votes>6</votes>
                                    <watches>7</watches>
                                                                                                                <comments>
                            <comment id="1884840" author="asya" created="Mon, 7 May 2018 17:04:50 +0000"  >&lt;p&gt;related to &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-714&quot; title=&quot;Allow findandmodify to retreive more than 1 record at a time&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-714&quot;&gt;SERVER-714&lt;/a&gt; (or might even be a duplicate)&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="190629" author="ian@10gen.com" created="Thu, 15 Nov 2012 20:08:59 +0000"  >&lt;p&gt;Anthony, no code has been committed for this feature yet and it is not yet scheduled.  You&apos;ll see the relevant version in the Fix Version field when we do schedule this for a release.&lt;/p&gt;</comment>
                            <comment id="190536" author="ahildoer" created="Thu, 15 Nov 2012 18:37:16 +0000"  >&lt;p&gt;Ian,&lt;/p&gt;

&lt;p&gt;I see you &quot;made changes&quot;. Does this mean the feature is in the code and will come out eventually? If so, what stable version, 2.2.x or 2.4.x? &lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</comment>
                            <comment id="103065" author="ahildoer" created="Fri, 23 Mar 2012 18:54:53 +0000"  >&lt;p&gt;Yes, findAndModify does this for one document. However, this request is for support for multiple documents, as the example in my first comment when I created the ticket indicates.&lt;/p&gt;</comment>
                            <comment id="103054" author="glenn" created="Fri, 23 Mar 2012 18:18:00 +0000"  >&lt;p&gt;Apparently the findAndModify command-&lt;del&gt;which is rather well-hidden in the documentation&lt;/del&gt;-can do this:&lt;/p&gt;

&lt;p&gt;db.foo.findAndUpdate({query: &lt;/p&gt;
{a:1}
&lt;p&gt;, update: {$set: {b:1}}, new: true);&lt;/p&gt;

&lt;p&gt;The only downside is that you can&apos;t tell whether an upsert was an insert or an update, but it looks like that information is available, just discarded by findAndUpdate(), so that can be worked around by making the command directly.&lt;/p&gt;

&lt;p&gt;(If findAndModify could avoid making a round-trip when fields is empty, it would obsolete update() entirely, so you wouldn&apos;t need to use very different API calls for similar operations.)&lt;/p&gt;</comment>
                            <comment id="94325" author="glenn" created="Thu, 1 Mar 2012 20:42:18 +0000"  >&lt;p&gt;I&apos;ve hit this problem, too.  Inserts give you the _id and update gives you the _id if it&apos;s a new item, but update doesn&apos;t if you update a single item.&lt;/p&gt;

&lt;p&gt;It would be better to support returning the entire updated record (optionally with field subsets).  This would allow implementing atomic &quot;return ++y&quot; updates, atomically return the new value, among other things.  Returning _id would be a simple case of this.  (Since this would be more expensive, it probably shouldn&apos;t be the default, especially if it&apos;s supported for multi updates.)&lt;/p&gt;</comment>
                            <comment id="55706" author="ahildoer" created="Wed, 21 Sep 2011 18:45:04 +0000"  >&lt;p&gt;Some updates do not involve the _id at all. The filter is on other fields, however I may want to &quot;listen&quot; to changes on documents by _id. &lt;/p&gt;

&lt;p&gt;For example, say I have the following collection:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.foo.find();&lt;/p&gt;

{ &quot;_id&quot; : ObjectId(&quot;4e791df2148d20c6f95cd3b9&quot;), &quot;a&quot; : 1, &quot;b&quot; : 1 }
{ &quot;_id&quot; : ObjectId(&quot;4e7a2ed6f41c94f7270ebcbb&quot;), &quot;a&quot; : 1 }
{ &quot;_id&quot; : ObjectId(&quot;4e7b2ed6f41c94f7248d20c6&quot;), &quot;a&quot; : 1, &quot;b&quot; : 2 }

&lt;p&gt;then I run:&lt;/p&gt;

&lt;p&gt;&amp;gt; db.foo.update(&lt;/p&gt;
{a:1}
&lt;p&gt;,{$set:{b:1}},false,true);&lt;/p&gt;

&lt;p&gt;This update modifies documents with _id 4e7a2ed6f41c94f7270ebcbb and _id 4e7b2ed6f41c94f7248d20c6, adding the b field, and changing the value of the b field, respectively. Is there a way of getting those _ids back so I know what documents were modified by the update command? I don&apos;t seem to find anything that will work, especially with sharded collections.&lt;/p&gt;</comment>
                            <comment id="55694" author="scotthernandez" created="Wed, 21 Sep 2011 18:15:01 +0000"  >&lt;p&gt;Update doesn&apos;t change the _id values. The _id field is immutable. &lt;/p&gt;

&lt;p&gt;If you do an update w/upsert then you may get a new document created and an ObjectId to go with it. You can check this after the update by following these directions: &lt;a href=&quot;http://www.mongodb.org/display/DOCS/Updating#Updating-CheckingtheOutcomeofanUpdateRequest&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.mongodb.org/display/DOCS/Updating#Updating-CheckingtheOutcomeofanUpdateRequest&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="11451">SERVER-714</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="113774">SERVER-12858</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>8.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25126"><![CDATA[Query Optimization]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 21 Sep 2011 18:15:01 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        5 years, 40 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>
                            5 years, 40 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>ahildoer</customfieldvalue>
            <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>backlog-query-optimization</customfieldvalue>
            <customfieldvalue>glenn</customfieldvalue>
            <customfieldvalue>ian@mongodb.com</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|hropxj:</customfieldvalue>

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

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

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