title: How to fix retryWrites in Mongo?
body: <p>I'm using mlab.com mongoDB and i can query into it but i can't insert into it</p>
  
  <h3>That's my class</h3>
  
  <pre><code>public class Main
  {
      private MongoUrl _url;
      private MongoClient _client;
  
      public Main(MongoUrl url)
      {
          url = new MongoUrl("mongodb://username:password@ds062807.mlab.com:62807/robobalancedb");
          _url = url;
          _client = new MongoClient(_url);
      }
  
      public async Task Login([Option]string username, [Option]string password)
      {
  
          var db = _client.GetDatabase("robobalancedb");
  
          var col = db.GetCollection&lt;User&gt;("users"); 
  
          var user = await (await col.FindAsync(x =&gt; x.Name == username &amp;&amp; x.Password == password)).FirstOrDefaultAsync();
  
      }
  
      public async Task Supply([Option(ShortName="u")] string username, [Option(ShortName="a")]double amount, [Option(ShortName="d")]string description)
      {
  
          var db = _client.GetDatabase("robobalancedb");
          var col = db.GetCollection&lt;OwnerSupply&gt;("ownersupplies");
  
          var supply = new OwnerSupply(){
              Amount = amount,
              Description = description
          };
  
          await col.InsertOneAsync(supply);
      }
  }
  </code></pre>
  
  <h3>Exception</h3>
  
  <p><a href="https://imgur.com/a/cSKNelR" rel="noreferrer">https://imgur.com/a/cSKNelR</a></p>
  
  <p>after searching I have tried to add ?retryWrites=true to my connection string
  <code>mongodb://username:password@ds062807.mlab.com:62807/?retryWrites=true/robobalancedb</code></p>
  
  <p>I got the Exception </p>
  
  <p>MongoDB.Driver.MongoConfigurationException: 'retryWrites has an invalid boolean value of false/robobalancedb.'</p>
  
  <p>and have tried to set RetryWrites in _client field by </p>
  
  <pre><code>_client.Settings.RetryWrites = false; 
  </code></pre>
  
  <p>got Exception 
  <code>System.InvalidOperationException: 'MongoClientSettings is frozen.'</code></p>