Q:

how to update subdocument mongodb

db.getCollection('products')
.update({"reviews.user": ObjectId("5f6e2e0b70eb0208fc8401a1")}, 
{$set: {"reviews.$.rating": NumberInt(3)}})
0

New to Communities?

Join the community