There is a collection of the following formats
"objectiveQuestions" : [{
"answer" : "A",
"index" : 2,
"isCorrect" : 1,
"subjectId" : 5967
}, {
"subjectId" : 5968,
"answer" : "A",
"isCorrect" : 0,
"index" : 3
}, ...]
Now for each inobjectiveQuestions
Element additionscore
Field, and give the initial value2
How is it constructedupdate
Where are the statements
Add one
multi: true
db.collection.update( <query>, <update>, { upsert: <boolean>, multi: <boolean>, writeConcern: <document> } )
http://docs.mongodb.org/manual/reference/method/db.collection.update/