diff --git a/Server/db/mongo/modules/monitorModule.js b/Server/db/mongo/modules/monitorModule.js index c40e7ea7b..76761ef26 100644 --- a/Server/db/mongo/modules/monitorModule.js +++ b/Server/db/mongo/modules/monitorModule.js @@ -314,12 +314,12 @@ const getMonitorById = async (monitorId) => { const notifications = await Notification.find({ monitorId: monitorId, }); - const updatedMonitor = await Monitor.findByIdAndUpdate( - monitorId, - { notifications }, - { new: true } - ).populate("notifications"); - return updatedMonitor; + + // Update monitor with notifications and save + monitor.notifications = notifications; + await monitor.save(); + + return monitor; } catch (error) { error.service = SERVICE_NAME; error.method = "getMonitorById";