Add several subdocument in mongodb -
i have following strucure:
{ 'name':'something', 'commens':{ 'value':'something' }, { 'value':'something else' } }
my question is, how can insert/update subdocuments?
if using mongodb console, have use $ positional operator update embedded documents.
db.yourcollection.update({ "_id" : objectid("4a33289ae89489"), "commens._id" : objectid("32321eae20fc603aee49124") }, { "$set" : { "commens.$.value" : "something else" } })
Comments
Post a Comment