-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: URI Options
-
None
-
Minor Change
-
Not Needed
-
Summary
We are unable to set Network Compression to "zstd" via the connection string. We use the MongoUrlBuilder to create the connection string. The Network Compression is lost when building the string via the MongoUrlBuidler.ToString() method.
Please provide the version of the driver. v = 2.20
How to Reproduce
- Copy -paste the proceeding code into an .net application
- Add a breakpoint on "hasNetworkCompressorSetting"
- Run code
Expected: hasNetworkCompressorSetting == true
Actual: hasNetworkCompressorSetting == false
var mongoConnectionString = "baseMongoConnectionString?compressors=zstd"; var builder = new MongoUrlBuilder(mongoConnectionString); var builderConnectionString = builder.ToString(); // results in "baseMongoConnectionString?compressors=zstandard" var settings = MongoClientSetttings.FromConnectionString(builderConnectionString); var hasNetworkCompressorSetting = settings.Compressors.Any()
Additional Background
I believe this should be a quick fix. The problem lies in the mapper. I've attached the code that prevents the compressor from being added. It does not register 'zstandard" as "zstd". A couple of potential fixes are:
- Rename CompressorType.ZStandard to CompressorType.Zstd
- Modify ConnectionString.SaveCompressors() to add the compressor if it's already in the ServerName format