Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1591

FindOneAndUpdate and FindOneAndUpdateAsync methods have duplicated checks for collection not being null

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 2.3
    • Affects Version/s: None
    • Component/s: Operations
    • None

      FindOneAndUpdate and FindOneAndUpdateAsync methods have duplicated checks for collection not being null, but no checks for filter as other methods do.
      Possible it is a typo and one check is excessive, or it is a bug and some necessary check is not done.

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      public static TDocument FindOneAndUpdate<TDocument>(this IMongoCollection<TDocument> collection, FilterDefinition<TDocument> filter, UpdateDefinition<TDocument> update, FindOneAndUpdateOptions<TDocument, TDocument> options = null, CancellationToken cancellationToken = default(CancellationToken))
      {
          Ensure.IsNotNull(collection, nameof(collection));
          Ensure.IsNotNull(collection, nameof(collection));
      

      https://github.com/mongodb/mongo-csharp-driver/blob/e2af10c0bf92fe1d4ed39bd27bad88c927bf9426/src/MongoDB.Driver/IMongoCollectionExtensions.cs#L697-L698

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            NickAb Nick Abalov [X]
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: