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

Unable to set Network Compression via Connection String for "zstd" when using MongoUrlBuilder

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.23.0
    • Affects Version/s: None
    • Component/s: URI Options
    • None
    • Minor Change
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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

      1. Copy -paste the proceeding code into an .net application
      2. Add a breakpoint on "hasNetworkCompressorSetting"
      3. 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:

      1. Rename CompressorType.ZStandard to CompressorType.Zstd
      2. Modify ConnectionString.SaveCompressors() to add the compressor if it's already in the ServerName format

            Assignee:
            james.kovacs@mongodb.com James Kovacs
            Reporter:
            rcramirezjr93@gmail.com Ruben Ramirez
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: