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 eventsFollowing
and I could figure out how to do it .
The array that I want to delete is below
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