使用 upsert 更新 Mongodb 失败 [英] Mongodb update with upsert fails

查看:95
本文介绍了使用 upsert 更新 Mongodb 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是失败的语句:

db.some_collection.update(query,modifier_set, upsert=True, safe=True)

modifier_set 的形式为 {"$inc":{...}, "$addToSet":{...}}

我收到一个 OperationFailure 错误:

$ 运算符使对象太大

现在,我的文档不太可能超过 16MB.

Now, it's highly unlikely that my document it more that 16MB.

这种失败还有其他可能的原因吗?

Any other possible reasons for such failure ?

推荐答案

其实就是文档过大的情况.
db.collection_name.stats() 确认了.

It is actually a case of oversized document.
db.collection_name.stats() confirmed it.

这篇关于使用 upsert 更新 Mongodb 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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