mongodb update set subdocument code example
Example: how to update subdocument mongodb
db.getCollection('products')
.update({"reviews.user": ObjectId("5f6e2e0b70eb0208fc8401a1")},
{$set: {"reviews.$.rating": NumberInt(3)}})
db.getCollection('products')
.update({"reviews.user": ObjectId("5f6e2e0b70eb0208fc8401a1")},
{$set: {"reviews.$.rating": NumberInt(3)}})