When the nested object is a hash object:
db.getCollection('some').update(
{ _id : Object('dfff')}, // query condition
{$set : { "embedded.field001":333}}
}
if When the nested object is an array, use the form of <array>.$.field
db.getCollection('some').update(
{ "embeddedArray.id":11}, // query condition
{$set : { "embeddedArray. $.field001":333}}
}
mongodb 的 inplace update
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326445896&siteId=291194637
Recommended
Ranking