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.'
}))
florinrelea