I have nested data:
Object
_id: "90fac6ab-b88e-42a1-8e91-80ee25951ec7"
answers: Array[4]
0: Object
name: "myData"
owned_by: "273b7291-df2b-494c-bd9b-64e71283447e"
score: 0
I am trying to update, only a specific nested answer
whose name I know. I would simply like to increment the score
field, and I only know name
. How does one accomplish this?
Thus far I have this: db.Question.update({_id: "90fac6ab-b88e-42a1-8e91-80ee25951ec7"}, "myData":{$inc: {score: 2}});