mongodbherokupymongomlabstorage-engines

Fix for Mongo RetryableWrites through deployment update rather than explicitly passed option?


What is the best solve for This MongoDB deployment does not support retryable writes? Are there versions/ set up that I should be using (e.g., finding a way to switch from MMAPv1 to WiredTiger), or is an explicit setting update of retryWrites=false truly the best solve for heroku mlab deployments?

Background:

At some point within the past few weeks my Heroku-provisioned mLab add on, which had been running smoothly for about a year, on any write attempt began throwing:

Exception: This MongoDB deployment does not support retryable writes. Please add retryWrites=false to your connection string.

I had not made any changes to the deployment or my driver, so I assume this new exception has to do with an update on mlab's end being incompatible to my own set up.

On discussions such as: How to fix retryWrites in Mongo? I have come across working fixes to the problem. The fixes call for passing a retryWrites=false option to the MongoClient, but it seems to me that while I can bypass the error, the issue of unsupported features on my MongoDB deployment have not truly been resolved.


Solution

  • Retryable writes are enabled by default in official drivers that have been updated for MongoDB 4.2.

    All modern versions of MongoDB server (I'm including MongoDB 3.6+ since 3.4 will be End-of-Life next month) also include retryable write support by default.

    The error message indicates you have an older server deployment or configuration which does not support retryable writes.

    To address this your options are:

    I'd recommend upgrading your MongoDB deployment, especially if you are still using the deprecated MMAPv1 storage engine or an EOL server version.