From b98ff0ad89ca21f4c49f8c4b9b8ff6a6784954ff Mon Sep 17 00:00:00 2001 From: A-nirvana Date: Sun, 7 Apr 2024 15:51:39 +0530 Subject: [PATCH] Update returns updated object --- controllers/blogControllers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/blogControllers.ts b/controllers/blogControllers.ts index ed79075..0ccbab9 100644 --- a/controllers/blogControllers.ts +++ b/controllers/blogControllers.ts @@ -34,7 +34,7 @@ const deleteBlog = async (req: Request, res: Response, next: NextFunction) => { const updateBlog = async (req: Request, res: Response, next: NextFunction) => { try {; const blogId = new Types.ObjectId(req.params.id); - const blog = await BlogModel.BlogSchema.findByIdAndUpdate(blogId, req.body) + const blog = await BlogModel.BlogSchema.findByIdAndUpdate(blogId, req.body,{new: true}) return res.status(httpStatus.OK).json({ blog: blog, message: "Blog was updated successfully"