Answers for "mongoose remove where"

4

mongoose find by and delete

Campground.findByIdAndRemove(req.params.id, function(err){
      if(err){
          res.redirect("/campgrounds");
      } else {
          res.redirect("/campgrounds");
      }
   });
Posted by: Guest on August-10-2020
0

mongoose remove

const res = await Character.remove({ name: 'Eddard Stark' });
res.deletedCount; // Number of documents removed
Posted by: Guest on June-09-2021

Code answers related to "mongoose remove where"

Browse Popular Code Answers by Language