MongoDB更新子数组

时间:2016-06-03 17:41:19

标签: mongodb-query

我是MongoDB的新手,我遇到了更新操作的问题。这是文件:

"_id" : ObjectId("507d95d5719dbef170f15c00"),
"name" : "Phone Service Family Plan",
"type" : "service",
"monthly_price" : 90,
"limits" : {
        "voice" : {
                "units" : "minutes",
                "n" : 1200,
                "over_rate" : 0.05
        },
        "data" : {
                "n" : "unlimited",
                "over_rate" : 0
        },
        "sms" : {
                "n" : "unlimited",
                "over_rate" : 0
        }
},
"sales_tax" : true,
"term_years" : 3

我想更新over_rate,将sms的限制从0更新为0.01。任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

try this? (first argument in update being the document you want to update)

presenter.changeItem()