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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -