mongodb delete subdocument by "index" code example
Example: how to delete subdocument mongodb
db.getCollection('products').update({},
{$pull: {reviews:
{user: ObjectId("5f6e2e0b70eb0208fc84011a")}}},
{multi: true})
db.getCollection('products').update({},
{$pull: {reviews:
{user: ObjectId("5f6e2e0b70eb0208fc84011a")}}},
{multi: true})