2

I use pymongo to implement mongo database. I am trying to use the sessions and transactions for the management of operations, but I encountered this error:

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

I tried this solution but without result:

myclient = pymongo.MongoClient("mongodb://localhost:27017/", retryWrites=False)
db = myclient["mydb"]
session = myclient.start_session()

Any help, thanks

1 Answers1

1

You need to run with the full connection string

myclient = pymongo.MongoClient("mongodb://localhost:27017/&retryWrites=false")

or specify all parameters

myclient = pymongo.MongoClient(
    host="localhost"
    port=27017
    retrywrites=False
)
trgiangdo
  • 76
  • 2