1

I have this code that allows me to delete data from mongoDB using node js but what I'm looking for is to delete the entire array eventsFollowingand I could figure out how to do it .

The array that I want to delete is below

enter image description here

the code that I'm using now is below :

exports.deletfollow = async (req, res, next) => {
  Author = req.body.userId;
  console.log(Author);
  eventFollowingId = req.body.followingId;
  User.update({ _id: Author }, { $unset: { eventsFollowing: "" } });
};

Any suggestions ?

Best Regards

0 Answers0