Coders for Causes BlogAbout

How to Delete Documents with Mongoose

December 30, 2018

You have to add a callback to the statement e.g. User.deleteOne({_id: req.params.userId}, err => console.log(err));

You can’t do something like this User.deleteOne({_id: req.params.userId})

If that doesn’t work try this longer way

  TodoList.findOne({ _id: req.params.todoListId}).then(result => {

David Yu

Written by David Yu who loves to build things in code.You should checkout our facebook for latest events and news