title: MongoError: This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string
body: <p>I am using <code>"mongoose": "^5.7.1"</code> in my Node.js project. I am making an api which involves updating in two documents. So, I am using the transactions like following:</p>
  
  <pre><code>// Start the transaction
  session = await mongoose.startSession()
  session.startTransaction()
  
  await Promise.all([
     &lt;1st update operation&gt;,
     &lt;2nd update operation&gt;
  ])
  
  // Commit the transaction
  session.commitTransaction()
  </code></pre>
  
  <p>When I hit this api on my local environment, I get following error:</p>
  
  <blockquote>
    <p>MongoError: This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.</p>
  </blockquote>
  
  <p>When I hit this api on remote environment, then it runs fine. I am using <a href="https://www.clever-cloud.com" rel="noreferrer">https://www.clever-cloud.com</a> as database cloud and AWS as api cloud.</p>
  
  <p>As written in error message, I have tried to put <code>retryWrites=false</code></p>
  
  <ul>
  <li>at the end of connection string that I am passing to mongoose as <code>mongodb://${ip}:${port}/${this.MONGO_DATABASE}?retryWrites=false</code></li>
  <li>with options as <code>retryWrites: false</code> passed to the <code>mongoose.connect</code> method.</li>
  </ul>
  
  <pre><code>mongoose.connect(`mongodb://${ip}:${port}/${this.MONGO_DATABASE}`, {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useCreateIndex: true,
      retryWrites: false
    }, (err) =&gt; {...})
  </code></pre>
  
  <p>None of the above resolved the issue.</p>
  
  <p>Below is the output of <code>mongo --version</code> command:</p>
  
  <pre><code>db version v4.0.13
  git version: bda366f0b0e432ca143bc41da54d8732bd8d03c0
  allocator: system
  modules: none
  build environment:
      distarch: x86_64
      target_arch: x86_64
  </code></pre>
  
  <p>I have debug and find the actual error behind throwing this error is:</p>
  
  <blockquote>
    <p>MongoError: Transaction numbers are only allowed on a replica set member or mongos</p>
  </blockquote>
  
  <p>Please suggest something.</p>