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:

Table of Contents

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

    Chris Sevilleja

    173 posts

    Founder of Google Developer Expert in Web Technologies. Slapping the keyboard until something good happens.