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

MongoClientSettings class not birectional with managing connection URL

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.10.0
    • Component/s: None
    • Labels:
      None

      Assuming that `MongoClientSettings.ToString` method does what the below example implies, I would expect it to work. It shows how a valid connection string - after it's been parsed,  default values derived from it, and finally reconstructed -  no longer works.

      [Fact]
      public void MongoClientSettings_Reconstruction_Localhost()
      {
      string connectionString = "mongodb://localhost:27017";
      var settings = MongoDB.Driver.MongoClientSettings.FromConnectionString(connectionString);
      
      string generatedConnectionString = settings.ToString();
      
      // Fails here with "The connection string is not valid" error
      // (MongoDB.Driver.MongoConfigurationException)
      var settings2 = MongoDB.Driver.MongoClientSettings.FromConnectionString(generatedConnectionString);
      
      Assert.True(settings.Equals(settings2));
      }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            hlubovac@gmail.com Hari Lubovac
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: