[CSHARP-1591] FindOneAndUpdate and FindOneAndUpdateAsync methods have duplicated checks for collection not being null Created: 07/Mar/16  Updated: 23/Sep/16  Resolved: 18/Mar/16

Status: Closed
Project: C# Driver
Component/s: Operations
Affects Version/s: None
Fix Version/s: 2.3

Type: Bug Priority: Trivial - P5
Reporter: Nick Abalov [X] Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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.

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



 Comments   
Comment by Githook User [ 18/Mar/16 ]

Author:

{u'username': u'rstam', u'name': u'rstam', u'email': u'robert@robertstam.org'}

Message: CSHARP-1591: Fix FindOneAndUpdate/Async checks for null arguments.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/515daab754e849cdd1f270383dc15e5a336e69a0

Generated at Wed Feb 07 21:40:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.