Updating nested arrays

I am getting the above error. I don’t understand where I am going wrong.

Could you please post your sample document as text enclosed in the pre html tag rather than a screenshot?

This way we could cut-n-paste it in our terminal to help investigate.

Hi @Hetal_57847,

Notice this {} in the update query.

Please use this update command for achieving the desired outcome :

 x.update(
   {grades:{$exists:true}},
   { $inc: { "grades.$[].questions.$[score]": 2 } },
   { arrayFilters: [  { "score": { $gte: 8 } } ], multi: true}
)

Hope it helps!

Let me know if you have any doubts.

Thanks,
Shubham Ranjan
Curriculum Services Engineer