controllers/thought-controller.js
// Remove a Reaction from a Thought
Remove a Reaction from a Thought
Remove a Reaction from a Thought
removeReaction({ params }, res) {
    Thought.findOneAndUpdate(
      { _id: params.thoughtId },
      { $pull: { reactions: { reactionId: params.reactionId } } },
      { new: true }
    )
    .then(dbThoughtData => {
      if (!dbThoughtData) {
        res.status(404).json({ message: 'No thought found with this id!' });
        return;
      }
      res.json(dbThoughtData);
    })
    .catch(err => res.json(err));
  }
removeReaction ( { params } , res ) { Thought . findOneAndUpdate ( { _id : params . thoughtId } , { $pull : { reactions : { reactionId : params . reactionId } } } , { new : true } ) . then ( dbThoughtData => { if ( ! dbThoughtData ) { res . status ( 404 ) . json ( { message : 'No thought found with this id!' } ) ; return ; } res . json ( dbThoughtData ) ; } ) . catch ( err => res . json ( err ) ) ; }
Remove a Reaction from a Thought
Remove a Reaction from a Thought