From 85a2dc7e7a9af0ebb57b8d60f6e812a89dd0b976 Mon Sep 17 00:00:00 2001 From: MohammadHMazarei Date: Tue, 24 Dec 2024 20:07:28 +0330 Subject: [PATCH] REMOVE: addresses from populate callback function in findById function called on user model --- middlewares/loginCheck.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middlewares/loginCheck.js b/middlewares/loginCheck.js index 1a0e439..2ce6ab2 100644 --- a/middlewares/loginCheck.js +++ b/middlewares/loginCheck.js @@ -28,7 +28,7 @@ exports.loginProtect = async (req, res, next) => { } // 3) check if user still exist - const loggedInUser = await User.findById(decodedToken.id).populate('role addresses') + const loggedInUser = await User.findById(decodedToken.id).populate('role') if (!loggedInUser) { return next(new AppError('TokenUserNotExist', 401, {}))