how to solve this transaction error in mlab? [MongoError: Transaction numbers are … support document-level locking]

霸气de小男生 提交于 2019-12-10 01:59:08

问题


I'm trying to do a simple transaction using mongoose. It worked totally fine on MongoDB Atlas, but in mlab I got such an error: MongoError: Transaction numbers are only allowed on storage engines that support document-level locking. I did some research, but didn't really find any resources regarding mlab and document-level locking. Does anyone know how to solve this problem?


回答1:


I have same issue, then I contact mlab help, here is their reply:

That error indicates your app/driver is attempting to use a feature that's not compatible with your Shared Cluster deployment, which employs the MMAPv1 storage einge. It's likely that you have retryable writes (https://docs.mongodb.com/manual/core/retryable-writes/) enabled. Can you try turning that feature off in the connection string (https://docs.mongodb.com/manual/reference/connection-string/#urioption.retryWrites), or directly from your driver settings?

Please let us know if you continue to experience this error after turning off this feature.

Based on this answer, I appended retryWrites=false in mongodb connection url, then it works well.



来源:https://stackoverflow.com/questions/55878421/how-to-solve-this-transaction-error-in-mlab-mongoerror-transaction-numbers-ar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!