<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:48:20 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-4473] Cannot resolve method &quot;UpdateOneAsync&quot;</title>
                <link>https://jira.mongodb.org/browse/CSHARP-4473</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;h4&gt;&lt;a name=&quot;Summary&quot;&gt;&lt;/a&gt;Summary&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;I am trying to Update / Replace an document with the C# MongoDB.Driver.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;``` csharp&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;var Collection =&lt;/em&gt; DbContext.DbSet&amp;lt;MyEntity&amp;gt;();&lt;br/&gt;
var filter = Builders&amp;lt;MyEntity&amp;gt;.Filter.Eq(x =&amp;gt; x.Id, entity.Id);&lt;br/&gt;
var update = Builders&amp;lt;MyEntity&amp;gt;.Update.Set(e =&amp;gt; e.Name, entity.Name);&lt;br/&gt;
await Collection.UpdateOneAsync(filter, update, cancellationToken);&lt;br/&gt;
&lt;em&gt;```&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;but whichever overload I am using, I get the error&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;```&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cannot resolve method &apos;UpdateOneAsync(MongoDB.Driver.FilterDefinition&amp;lt;MyEntity&amp;gt;, MongoDB.Driver.UpdateDefinition&amp;lt;MyEntity&amp;gt;, System.Threading.CancellationToken)&apos;, candidates are: System.Threading.Tasks.Task&amp;lt;MongoDB.Driver.UpdateResult&amp;gt; UpdateOneAsync(MongoDB.Driver.FilterDefinition&amp;lt;MyEntity&amp;gt;, MongoDB.Driver.UpdateDefinition&amp;lt;MyEntity&amp;gt;, MongoDB.Driver.UpdateOptions, System.Threading.CancellationToken) (in interface IMongoCollection&amp;lt;MyEntity&amp;gt;) System.Threading.Tasks.Task&amp;lt;MongoDB.Driver.UpdateResult&amp;gt; UpdateOneAsync(MongoDB.Driver.IClientSessionHandle, MongoDB.Driver.FilterDefinition&amp;lt;MyEntity&amp;gt;, MongoDB.Driver.UpdateDefinition&amp;lt;MyEntity&amp;gt;, MongoDB.Driver.UpdateOptions, System.Threading.CancellationToken) (in interface IMongoCollection&amp;lt;MyEntity&amp;gt;) System.Threading.Tasks.Task&amp;lt;MongoDB.Driver.UpdateResult&amp;gt; UpdateOneAsync&amp;lt;MyEntity&amp;gt;(this MongoDB.Driver.IMongoCollection&amp;lt;MyEntity&amp;gt;, MongoDB.Driver.IClientSessionHandle, System.Linq.Expressions.Expression&amp;lt;System.Func&amp;lt;MyEntity,bool&amp;gt;&amp;gt;, MongoDB.Driver.UpdateDefinition&amp;lt;MyEntity&amp;gt;, MongoDB.Driver.UpdateOptions, System.Threading.CancellationToken) (in class IMongoCollectionExtensions) System.Threading.Tasks.Task&amp;lt;MongoDB.Driver.UpdateResult&amp;gt; UpdateOneAsync&amp;lt;MyEntity&amp;gt;(this MongoDB.Driver.IMongoCollection&amp;lt;MyEntity&amp;gt;, System.Linq.Expressions.Expression&amp;lt;System.Func&amp;lt;MyEntity,bool&amp;gt;&amp;gt;, MongoDB.Driver.UpdateDefinition&amp;lt;MyEntity&amp;gt;, MongoDB.Driver.UpdateOptions, System.Threading.CancellationToken) (in class IMongoCollectionExtensions)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;```&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&#160;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I guess this is a bug, but I am not sure if I am the one who does something wrong here.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Other methods like &quot;FindAsync&quot;, &quot;InsertOneAsync&quot;, etc work as expected&lt;/em&gt;&lt;/p&gt;
&lt;h4&gt;&lt;a name=&quot;MongoDB.Driver%3A2.18.0&quot;&gt;&lt;/a&gt;MongoDB.Driver: 2.18.0&lt;/h4&gt;</description>
                <environment></environment>
        <key id="2224704">CSHARP-4473</key>
            <summary>Cannot resolve method &quot;UpdateOneAsync&quot;</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="13202">Works as Designed</resolution>
                                        <assignee username="dmitry.lukyanov@mongodb.com">Dmitry Lukyanov</assignee>
                                    <reporter username="daniel@zookeeper.app">Daniel Martin</reporter>
                        <labels>
                    </labels>
                <created>Thu, 5 Jan 2023 13:27:54 +0000</created>
                <updated>Fri, 27 Oct 2023 13:24:39 +0000</updated>
                            <resolved>Thu, 5 Jan 2023 14:32:37 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="5092771" author="JIRAUSER1272480" created="Thu, 5 Jan 2023 14:26:55 +0000"  >&lt;p&gt;Yes this works! Thanks a lot!&#160;&lt;/p&gt;</comment>
                            <comment id="5092624" author="dmitry.lukyanov" created="Thu, 5 Jan 2023 13:55:47 +0000"  >&lt;p&gt;Hey &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=daniel%40zookeeper.app&quot; class=&quot;user-hover&quot; rel=&quot;daniel@zookeeper.app&quot;&gt;daniel@zookeeper.app&lt;/a&gt;, &lt;/p&gt;

&lt;p&gt;as I can see, your issue is related to the fact that you&apos;re trying to call UpdateOneAsync overload that doesn&apos;t exist. If you want to avoid the 3rd argument which is &quot;UpdateOptions&quot; and still using cancellationToken, specify cancellationToken argument name explicitly like: &lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    .UpdateOneAsync(filter, update, cancellationToken: CancellationToken.None)&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&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|i17p74:</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>