What is a TransientTransactionError in Mongoose (or MongoDB)?

If there is no security issue and you are just doing it for connecting: While setting up the IP Whitelist; format should be 0.0.0.0/0 , you will not face the issue.

enter image description here

Moreover, as you have answered yourself, we can add the ip for which we need access.


What is a TransientTransactionError

A TransientTransactionError is a transactional error that is classified as temporary, and if retried it may be successful. Furthermore, a TransientTransactionError write conflict occurs prior to a commit when no write lock has been taken and the transaction (new data) is not reflected in the transaction snapshot (previous data.) As a result, these errors are completely safe to retry until there is a successful commit.

Transactions that retry in this scenario are retried from the beginning of the transaction.

Keep in mind This error label is different than commit errors that happen when the lock has been taken but the transaction can't complete its commit. The error label for this is UnknownTransactionCommitResult. The reference to this is notable due to the difference in understanding where in your application an error is occurring and what may be the underlying cause and how the application can and or will respond due to different error types.

If you're using MongoDB supported drivers, there are two possible cause the code is getting this error:

  • Any database command error that includes the "TransientTransactionError" error label in the "errorLabels" field.
  • Any network error encountered running any command other than commitTransaction in a transaction.

The code example in MongoDB Transactions: retry-transaction show cased how to handle TransientTransactionError.

If the error message is MongoNetworkError, it means the transient transaction error is related to the network connectivity between the client and the server. This could either be a one time network glitch which is retry-able, or there is no network access which require network configuration. If the error is encountered on the first time the client trying to access the server, it is likely that there is network configuration needed. If the server is on MongoDB Atlas, please see Configure Whitelist Entries.


I had

  'MongoNetworkError',
  errorLabels: [ 'TransientTransactionError' ],
  [Symbol(mongoErrorContextSymbol)]:

I added my current IP to whiteList following "main page > security section > network access > add IP" in MongoDB website.

I hope this helps.