如何解决mlab中的交易错误? [MongoError:事务号...支持文档级锁定] [英] how to solve this transaction error in mlab? [MongoError: Transaction numbers are ... support document-level locking]

查看:308
本文介绍了如何解决mlab中的交易错误? [MongoError:事务号...支持文档级锁定]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用mongoose进行简单的交易.它在MongoDB Atlas上工作得很好,但是在mlab中,我得到了这样的错误:MongoError: Transaction numbers are only allowed on storage engines that support document-level locking.我做了一些研究,但并没有真正找到有关mlabdocument-level locking的任何资源. 有人知道如何解决这个问题吗?

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?

推荐答案

我遇到了同样的问题,然后我联系了mlab帮助,这是他们的回复:

该错误表明您的应用程序/驱动程序正在尝试使用与您的共享群集部署不兼容的功能,该功能使用了MMAPv1存储设备.您可能有可重试的写入内容( https://docs.mongodb.com/manual/核心/可重试写入/).您可以尝试在连接字符串( https://docs.mongodb.com/manual/reference/connection-string/#urioption.retryWrites ),还是直接从您的驱动程序设置中获取?

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.

基于此答案,我在mongodb连接url中附加了retryWrites = false,然后运行良好.

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

这篇关于如何解决mlab中的交易错误? [MongoError:事务号...支持文档级锁定]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆