0

I'm new to mongo database.Please help me in writing the query updation. I already had a collection in mongo and i would like to add a new field in existing object field.the structure is as follows.

{ "_class" : "PersistentContent", "originalId" : "2070", "videoInfo" : { "test1" : ["res"] }, } 

I would like to update the structure to below format.

{ "_class" : "PersistentContent", "originalId" : "2070", "videoInfo" : { "test1" : ["res"], "test2" : ["res2"] }, } 

How to update the collection and add test2 into videoInfo tag.

1 Answer 1

2

use

db.test.update({"originalId" : "2070"}, { $set : { "videoInfo.test2" : ["res2"] } }) 
Sign up to request clarification or add additional context in comments.

2 Comments

while inserting it manually its is inserting but when inserting it through jongo mongo java code its not getting inserted
Your question tagged as mongodb not jongo, and i have no idea about jongo

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.