[CSHARP-2065] Support ReplaceOptions in CRUD API Created: 13/Oct/17  Updated: 28/Oct/23  Resolved: 08/Oct/19

Status: Closed
Project: C# Driver
Component/s: API, Write Operations
Affects Version/s: 2.4.4
Fix Version/s: 2.10.0

Type: New Feature Priority: Major - P3
Reporter: Robert Stam Assignee: Dmitry Lukyanov (Inactive)
Resolution: Fixed Votes: 1
Labels: deprioritized, driver-current-quarter, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by DRIVERS-416 Support ReplaceOptions in CRUD API Closed
Backwards Compatibility: Fully Compatible

 Description   

Add new overload of ReplaceOne that takes ReplaceOptions



 Comments   
Comment by Githook User [ 08/Oct/19 ]

Author:

{'name': 'Dmitry Lukyanov', 'username': 'DmitryLukyanov', 'email': 'dmitry.lukyanov@mongodb.com'}

Message: CSHARP-2065: Support ReplaceOptions in CRUD API.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/f41aacacd871a18f09a42935e39953ed4de8a352

Comment by Robert Stam [ 16/Oct/17 ]

Suspending work on this until we decide what we want to do about backward compatibility issues.

The natural way to implement this change is to add new overloads of ReplaceOne that take a ReplaceOptions value (the existing overloads take an UpdateOptions).

The problems identified are:

collection.ReplaceOne(filter, replacement); // is potentially ambiguous

This call would be ambiguous if both overloads declare the options parameter as optional. We can fix this by changing the existing overload to take a mandatory UpdateOptions and only have the options be optional in the new overload that takes a ReplaceOptions.

collection.ReplaceOne(filter, replacement, null); // is ambiguous

This call is ambiguous because the compiler can't decide whether the null argument is a null UpdateOptions or a null ReplaceOptions.

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