Cannot resolve method "UpdateOneAsync"

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      I am trying to Update / Replace an document with the C# MongoDB.Driver.

       

      ``` csharp

      var Collection = DbContext.DbSet<MyEntity>();
      var filter = Builders<MyEntity>.Filter.Eq(x => x.Id, entity.Id);
      var update = Builders<MyEntity>.Update.Set(e => e.Name, entity.Name);
      await Collection.UpdateOneAsync(filter, update, cancellationToken);
      ```

       

      but whichever overload I am using, I get the error

       

      ```

      Cannot resolve method 'UpdateOneAsync(MongoDB.Driver.FilterDefinition<MyEntity>, MongoDB.Driver.UpdateDefinition<MyEntity>, System.Threading.CancellationToken)', candidates are: System.Threading.Tasks.Task<MongoDB.Driver.UpdateResult> UpdateOneAsync(MongoDB.Driver.FilterDefinition<MyEntity>, MongoDB.Driver.UpdateDefinition<MyEntity>, MongoDB.Driver.UpdateOptions, System.Threading.CancellationToken) (in interface IMongoCollection<MyEntity>) System.Threading.Tasks.Task<MongoDB.Driver.UpdateResult> UpdateOneAsync(MongoDB.Driver.IClientSessionHandle, MongoDB.Driver.FilterDefinition<MyEntity>, MongoDB.Driver.UpdateDefinition<MyEntity>, MongoDB.Driver.UpdateOptions, System.Threading.CancellationToken) (in interface IMongoCollection<MyEntity>) System.Threading.Tasks.Task<MongoDB.Driver.UpdateResult> UpdateOneAsync<MyEntity>(this MongoDB.Driver.IMongoCollection<MyEntity>, MongoDB.Driver.IClientSessionHandle, System.Linq.Expressions.Expression<System.Func<MyEntity,bool>>, MongoDB.Driver.UpdateDefinition<MyEntity>, MongoDB.Driver.UpdateOptions, System.Threading.CancellationToken) (in class IMongoCollectionExtensions) System.Threading.Tasks.Task<MongoDB.Driver.UpdateResult> UpdateOneAsync<MyEntity>(this MongoDB.Driver.IMongoCollection<MyEntity>, System.Linq.Expressions.Expression<System.Func<MyEntity,bool>>, MongoDB.Driver.UpdateDefinition<MyEntity>, MongoDB.Driver.UpdateOptions, System.Threading.CancellationToken) (in class IMongoCollectionExtensions)

      ```

       

      I guess this is a bug, but I am not sure if I am the one who does something wrong here.

      Other methods like "FindAsync", "InsertOneAsync", etc work as expected

      MongoDB.Driver: 2.18.0

            Assignee:
            Dmitry Lukyanov (Inactive)
            Reporter:
            Daniel Martin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: