title: The meaning of ?retryWrites=true&w=majority when you connect Node.js app to Cluster on MongoDB Atlas
body: <p>When we connect a Node.js application to a cluster on the mongoDB Atlas, we need to add the following URI instead of adding <code>&quot;mongodb://localhost:27017/&lt;dbname&gt;&quot;</code> as you can see at the step 2 in the image.</p>
  <pre><code>&quot;mongodb+srv://&lt;username&gt;:&lt;password&gt;@cluster1.tv7cp.mongodb.net/&lt;dbname&gt;?retryWrites=true&amp;w=majority&quot;
  </code></pre>
  <p>Now, what exactly the meaning of <code>?retryWrites=true&amp;w=majority</code> in it after <code>&lt;dbname&gt;</code>? Why do we need to add it?</p>
  <p>I tried and ran the app with mongoose without <code>?retryWrites=true&amp;w=majority</code>, and it worked fine.</p>
  <p><a href="https://i.stack.imgur.com/0XF16l.png" rel="noreferrer"><img src="https://i.stack.imgur.com/0XF16l.png" alt="enter image description here" /></a></p>