I am using Java Mongo driver for the DB interaction. I have regular updates to be performed on the DB rows and the object that is quite nested. Something like this :
MyObject:
{
_id: dbGeneratedId,
myId: "A String ID that i created",
myTime: "new Date()",
myList:
[
{
myString: "abcdefghij",
myInteger: 9000
},
{
myString: "qwertyasdf",
myInteger: 9001
},
{
myString: "loremipsum",
myInteger: 9002
}
]
}
Each update involves either adding a new List item under myList
or appending some string to the myString
object in each of the List item. I found a lot of references for writing/finding items and none for updating items in a nested object. Can someone help me with this.
Edit 1: It would also be helpful if someone points out how to get one of the List items based on a myInteger
search
PS: new to mongo thro Java, excuse my ignorance