mongoose increment sub document code example
Example: mongoose increment sub document
BlogPost.update({_id: blogPostId, 'comments._id': commentId}, {$inc:{'comments.$.rating':1}})
.then((blogPost) => res.status(200).json({
'status': 'Comment rating is increased.'
}))