Updating elements of Array of objects

My data looks some like

"rating_score_detail":[
        {
          "star_value":5,
          "number_of_ratings":34
        },
        {
            "star_value":4,
            "number_of_ratings":2
        },
        {
            "star_value":3,
            "number_of_ratings":0
        },
        {
            "star_value":2,
            "number_of_ratings":0
        },
        {
            "star_value":1,
            "number_of_ratings":1
          }
     ]

Which is basically an array of objects
I want to have a mongodb query so that I can edit a single element for example rating_score_detail [0] the element, key : number_of_ratings.

How can I be able to do this?

Hi there! If you'd like to update a single element in an array, you could use dot notation within the update operation; it will likely look something like:

...
{
$set: {
"rating_score_detail.0.number_of_ratings": 50
}
}
...