<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:35: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>[CSHARP-58] MongoCollection&lt;T&gt;.FindAndModify doesn&apos;t work when updating an whole document.</title>
                <link>https://jira.mongodb.org/browse/CSHARP-58</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;MongoCollection&amp;lt;T&amp;gt;.FindAndModify doesn&apos;t work when updating an whole document.&lt;br/&gt;
The following code does no change to the database:&lt;br/&gt;
Document query = &lt;br/&gt;
  new Document() &lt;br/&gt;
  { &lt;/p&gt;
        { &quot;_id&quot;, new Oid(&quot;4c7541d563804c1680000001&quot;) } 
&lt;p&gt;  }; &lt;br/&gt;
mongo&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;DB&amp;quot;&amp;#93;&lt;/span&gt;.GetCollection&amp;lt;MyClass&amp;gt;(&quot;Collection&quot;).FindAndModify(theModifiedInstance, query); &lt;/p&gt;

&lt;p&gt;On the other side, the following (supposedly equivalent) works fine:&lt;br/&gt;
Document command = &lt;br/&gt;
new Document() &lt;br/&gt;
{ &lt;br/&gt;
        &lt;/p&gt;
{&quot;findandmodify&quot;, &quot;Collection&quot;}
&lt;p&gt;, &lt;br/&gt;
        &lt;/p&gt;
{&quot;query&quot;, query}
&lt;p&gt;, &lt;br/&gt;
        &lt;/p&gt;
{&quot;update&quot;, theModifiedInstance}
&lt;p&gt;, &lt;br/&gt;
        &lt;/p&gt;
{&quot;new&quot;, false}
&lt;p&gt;, &lt;/p&gt;
        {&quot;upsert&quot;, false} 
&lt;p&gt;}; &lt;br/&gt;
mongo&lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;DB&amp;quot;&amp;#93;&lt;/span&gt;.SendCommand(command); &lt;/p&gt;

&lt;p&gt;The bug seems to be on  line 217 of MongoCollection_1.cs (as per version given in &quot;Environment&quot;):&lt;/p&gt;
{&quot;update&quot;, EnsureUpdateDocument(document)} 
&lt;p&gt;EnsureUpdateDocument will create a new document with a $set. Clearly, from the example above, this should not be done.&lt;/p&gt;</description>
                <environment>samus-mongodb-csharp-85d3524&lt;br/&gt;
MongoDB 1.6</environment>
        <key id="12927">CSHARP-58</key>
            <summary>MongoCollection&lt;T&gt;.FindAndModify doesn&apos;t work when updating an whole document.</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="3">Duplicate</resolution>
                                        <assignee username="sam">Sam Corder</assignee>
                                    <reporter username="gduford">Gabriel Duford</reporter>
                        <labels>
                    </labels>
                <created>Thu, 26 Aug 2010 13:08:40 +0000</created>
                <updated>Wed, 19 Oct 2016 14:16:06 +0000</updated>
                            <resolved>Thu, 11 Nov 2010 20:07:12 +0000</resolved>
                                                                    <component>SAMUS</component>
                                        <votes>0</votes>
                                    <watches>0</watches>
                                                                                                                <comments>
                            <comment id="20247" author="lanwin" created="Thu, 11 Nov 2010 20:07:12 +0000"  >&lt;p&gt;Migrated to &lt;a href=&quot;https://github.com/mongodb-csharp/mongodb-csharp/issues/issue/25&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb-csharp/mongodb-csharp/issues/issue/25&lt;/a&gt;&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|hrh9xz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>14410</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>