title: Requirements for using MongoDB transactions
body: <p>When creating a new ticket I am trying to use mongo transactions so that I could rollback the transaction if at least one of the "ticket saving process" or "Publishing the ticket created event" fails.</p>
  
  <p>Inside the try catch block I have manually thrown the error (throw new Error('ssomlk caused manual error');) so I could try to test whether the transaction works.</p>
  
  <pre><code>const session = await mongoose.startSession();
  session.startTransaction();
  try {
    await ticket.save({ session });
    throw new Error('ssomlk caused manual error');
    await new TicketCreatedPublisher(natsWrapper.client).publish({
      id: ticket.id,
      title: ticket.title,
      price: ticket.price,
      createdBy: ticket.createdBy,
    });
    await session.commitTransaction();
    session.endSession();
    res.status(201).send(ticket);
  } catch (error) {
    session.abortTransaction();
    session.endSession();
    console.log(error);
    res.status(401).send({ error: error.message });
  }
  </code></pre>
  
  <p>But I am getting the below error</p>
  
  <p>MongoError: This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.</p>
  
  <p>According to stackoverflow answers I have included "?retryWrites=false" to my mongo URI but still no luck.</p>
  
  <p>Any advise would be of great help</p>