Update:

var comment = blog.comments.id(comment_id);
comment.author = 'Bruce Wayne';

blog.save(function (err) {
    // emmbeded comment with author updated     
});

Delete:

Blog.findByIdAndUpdateAsync(blogId, {
    $pull: { comments: {_id: commentId}}
  })
  .then(blog => {
    res.status(200).json('Comment is deleted successfully.');
  })
  .catch(err => {
    console.error(err);
    res.status(500).json(err.message || err);
  });

Leave a Reply