<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:35:07 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>[GODRIVER-861] Improvement Upsert in FindAndModify</title>
                <link>https://jira.mongodb.org/browse/GODRIVER-861</link>
                <project id="14289" key="GODRIVER">Go Driver</project>
                    <description>&lt;p&gt;WHY:&lt;/p&gt;

&lt;p&gt;&#160;- I&apos;m integrating mongo-go-driver into our project to replace the mgo&#160;library. At the command findAndModify, I want to get the&#160;UpdatedExisting&#160;field in FindAndModify struct when using the Upsert option. That will let me know the document is inserted or updated. For example: FindOneAndUpdate function.&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</description>
                <environment></environment>
        <key id="709508">GODRIVER-861</key>
            <summary>Improvement Upsert in FindAndModify</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="jeff.yemin@mongodb.com">Jeffrey Yemin</assignee>
                                    <reporter username="tkquang">Quang Tong</reporter>
                        <labels>
                    </labels>
                <created>Tue, 5 Mar 2019 08:11:47 +0000</created>
                <updated>Thu, 19 Aug 2021 14:15:05 +0000</updated>
                            <resolved>Thu, 18 Apr 2019 20:28:02 +0000</resolved>
                                    <version>1.0.0-rc2</version>
                                                    <component>CRUD</component>
                                        <votes>0</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="4009663" author="JIRAUSER1261958" created="Thu, 19 Aug 2021 14:15:05 +0000"  >&lt;p&gt;Hi guys!&lt;/p&gt;

&lt;p&gt;Jeffry&apos;s answer seem a bit inaccurate because the &lt;a href=&quot;https://github.com/mongodb/mongo-ruby-driver/pull/226&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;Ruby&lt;/a&gt; driver had this option back in 2013.&lt;/p&gt;

&lt;p&gt;P.S. Running generic RunCommand helper method is not an option since there&apos;s a lot of internal boilerplate stuff prior to the findAndModify call which just can&apos;t be omitted and can&apos;t be called from the external package.&#160;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;</comment>
                            <comment id="2199509" author="jeff.yemin" created="Tue, 2 Apr 2019 18:14:09 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=tkquang&quot; class=&quot;user-hover&quot; rel=&quot;tkquang&quot;&gt;tkquang&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Currently none of the MongoDB drivers, nor the shell, provide access via the various findAndModify helper method (FindOneAndUpdate, etc.) to the &lt;tt&gt;lastErrorObject&lt;/tt&gt; from the command response, which is what contains the &lt;tt&gt;updatedExisting&lt;/tt&gt; field.  They just return the document itself.&lt;/p&gt;

&lt;p&gt;If your application requires access to that field, the best way to do that is to execute the &lt;a href=&quot;https://docs.mongodb.com/v2.6/reference/command/findAndModify/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;findAndModify&lt;/a&gt; command via the generic &lt;tt&gt;RunCommand&lt;/tt&gt; helper method. &lt;/p&gt;
</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|huf9lb:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>