<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 07:39:41 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>[DOCS-861] Clarify behavior of findAndModify with upsert</title>
                <link>https://jira.mongodb.org/browse/DOCS-861</link>
                <project id="10380" key="DOCS">Documentation</project>
                    <description>&lt;p&gt;If several clients dispatch a findAndModify command on the same target collection, under certain circumstances, multiple documents may be inserted.  The simplest case to understand is when all of the findAndModify commands are issued with identical match criteria, say &lt;/p&gt;
{ name: &quot;andy&quot; }
&lt;p&gt;.  Suppose that initially, no document with &lt;/p&gt;
{ name : &quot;andy&quot; }
&lt;p&gt; exists, and there is no unique index on the &quot;name&quot; field.  In this case, if several of the findAndModify commands complete the &quot;find&quot; phase of the operation before any engage in the &quot;modify&quot; phase, those instances of the command may all choose to perform an insert of a new document, since no matching document was found.  This is the same as the behavior of &quot;update&quot; operations with upsert behavior.&lt;/p&gt;

&lt;p&gt;In the above example, had there been a unique index on the &quot;name&quot; field, each fAndM command instance would have seen one of the following behaviors:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Exactly one fAndM execution would successfully insert a new document.&lt;/li&gt;
	&lt;li&gt;Zero or more fAndMs would update the document inserted by the inserter.&lt;/li&gt;
	&lt;li&gt;Zero or more fAndMs would fail when they attempted to insert a duplicate.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;To implement, for example, a counter with fAndM, use a unique index on the identifying field (like the name), and if an fAndM fails due to unique index constraint violation, simply repeat it.  It will not fail due to this race multiple times, unless there is a process deleting counter documents.&lt;/p&gt;</description>
                <environment></environment>
        <key id="58673">DOCS-861</key>
            <summary>Clarify behavior of findAndModify with upsert</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="kay.kim@mongodb.com">Kay Kim</assignee>
                                    <reporter username="schwerin@mongodb.com">Andy Schwerin</reporter>
                        <labels>
                    </labels>
                <created>Fri, 7 Dec 2012 19:02:56 +0000</created>
                <updated>Mon, 13 Nov 2023 18:37:12 +0000</updated>
                            <resolved>Tue, 19 Feb 2013 18:36:34 +0000</resolved>
                                                    <fixVersion>mongodb-2.2</fixVersion>
                    <fixVersion>Server_Docs_20231030</fixVersion>
                    <fixVersion>Server_Docs_20231106</fixVersion>
                    <fixVersion>Server_Docs_20231105</fixVersion>
                    <fixVersion>Server_Docs_20231113</fixVersion>
                                    <component>manual</component>
                        <due></due>
                            <votes>1</votes>
                                    <watches>4</watches>
                                                                                                                <comments>
                            <comment id="270391" author="auto" created="Tue, 19 Feb 2013 21:47:25 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-02-19T21:35:15Z&apos;, u&apos;name&apos;: u&apos;Sam Kleinman&apos;, u&apos;email&apos;: u&apos;samk@10gen.com&apos;}
&lt;p&gt;Message: merge: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt;&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/f1da0c28c1f357fc806d906b9db046f186108d14&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/f1da0c28c1f357fc806d906b9db046f186108d14&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="270390" author="auto" created="Tue, 19 Feb 2013 21:47:23 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-01-15T04:40:19Z&apos;, u&apos;name&apos;: u&apos;kay&apos;, u&apos;email&apos;: u&apos;kay.kim@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findAndModify and upserts can insert multiple documents&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findandmodify upsert clarification&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findandmodify upsert clarification&lt;/p&gt;

&lt;p&gt;findAndModify flesh out what is returned&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; multiple invocation of findAndModify and flesh out results&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/8affb07c2f969c59f3b38a4c31a5b43185def9fd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/8affb07c2f969c59f3b38a4c31a5b43185def9fd&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="270389" author="auto" created="Tue, 19 Feb 2013 21:47:21 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-01-15T04:40:19Z&apos;, u&apos;name&apos;: u&apos;kay&apos;, u&apos;email&apos;: u&apos;kay.kim@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findAndModify and upserts can insert multiple documents&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findandmodify upsert clarification&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findandmodify upsert clarification&lt;/p&gt;

&lt;p&gt;findAndModify flesh out what is returned&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; multiple invocation of findAndModify and flesh out results&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/8affb07c2f969c59f3b38a4c31a5b43185def9fd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/8affb07c2f969c59f3b38a4c31a5b43185def9fd&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="270388" author="auto" created="Tue, 19 Feb 2013 21:47:19 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-01-15T04:40:19Z&apos;, u&apos;name&apos;: u&apos;kay&apos;, u&apos;email&apos;: u&apos;kay.kim@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findAndModify and upserts can insert multiple documents&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findandmodify upsert clarification&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findandmodify upsert clarification&lt;/p&gt;

&lt;p&gt;findAndModify flesh out what is returned&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; multiple invocation of findAndModify and flesh out results&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/8affb07c2f969c59f3b38a4c31a5b43185def9fd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/8affb07c2f969c59f3b38a4c31a5b43185def9fd&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="270387" author="auto" created="Tue, 19 Feb 2013 21:47:17 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{u&apos;date&apos;: u&apos;2013-01-15T04:40:19Z&apos;, u&apos;name&apos;: u&apos;kay&apos;, u&apos;email&apos;: u&apos;kay.kim@10gen.com&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findAndModify and upserts can insert multiple documents&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findandmodify upsert clarification&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; findandmodify upsert clarification&lt;/p&gt;

&lt;p&gt;findAndModify flesh out what is returned&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/DOCS-861&quot; title=&quot;Clarify behavior of findAndModify with upsert&quot; class=&quot;issue-link&quot; data-issue-key=&quot;DOCS-861&quot;&gt;&lt;del&gt;DOCS-861&lt;/del&gt;&lt;/a&gt; multiple invocation of findAndModify and flesh out results&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/docs/commit/8affb07c2f969c59f3b38a4c31a5b43185def9fd&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/docs/commit/8affb07c2f969c59f3b38a4c31a5b43185def9fd&lt;/a&gt;&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="51516">SERVER-7170</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="227279">SERVER-20158</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="72702">DOCS-1429</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>5.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 19 Feb 2013 21:47:17 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        11 years, 1 day 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>emet.ozar@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            11 years, 1 day ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>schwerin@mongodb.com</customfieldvalue>
            <customfieldvalue>auto</customfieldvalue>
            <customfieldvalue>kay.kim@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrs5vr:</customfieldvalue>

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

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>36120</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_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hryfi7:</customfieldvalue>

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