我有一个应用程序在MongoDB的顶部使用Mongoid和更新失败默默。MongoDB更新查询失败默默
的代码看起来是这样的:
# Are we getting a new attribute? Yes we are!
p "attr first name = #{@attributes['first_name']}"
if user.update_attributes!(@attributes)
u = User.find(params[:id]).to_json
end
无异常在此代码抛出。所以,我看着我的MongoDB的日志,并构建了基于什么蒙戈正在努力做到这一点查询:
db.users.update({ "_id": "4d5561276ce886c496000001" }, { $set: { "first_name": "Erinamodobo" } }, false);
现在,这不会导致任何异常,但是当我们把这个本来与此查询更新的记录:
db.users.find({"email":"[email protected]"})
我看到“first_name”属性尚未更新。
任何想法为什么会发生这种情况?听起来很愚蠢。
谢谢!
我不知道谁在地球上给了这个投票下来,但我投了票。 – 2011-02-16 19:20:11