Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem in code of deleting review (Deletion handling) #17

Open
viz2289132 opened this issue Jul 11, 2024 · 1 comment
Open

Problem in code of deleting review (Deletion handling) #17

viz2289132 opened this issue Jul 11, 2024 · 1 comment

Comments

@viz2289132
Copy link

//delete review route
// app.delete(
// "/listings/:id/reviews/:reviewId",
// wrapAsync(async(req,res)=>{
// let {id , reviewId} = req.params;

// await Listing.findByIdAndDelete(id , {$pull : {reviews : reviewId}});
// await Review.findByIdAndDelete(reviewId);

// res.redirect(/listings/${id});
// })
// )

kindly bug it

@Keshav-Verma-06
Copy link

It will be
await Listing.findByIdAndUpdate(id , {$pull : {reviews : reviewId}});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants