Deleting events is similar to .findOne(). Instead of .findOne(), we'll use .remove(). We can delete based on an object we pass in. Whatever matches that object will get deleted:

Event.remove({ slug: req.params.slug }, (err) => {
  // set flash data
  req.flash('success', 'Event deleted!');

  // redirect back to the events page
  res.redirect('/events');
});

Chris Sevilleja

168 posts

Co-founder of Scotch.io. Slapping the keyboard until something good happens.