From 7f6460ade35a44165cf8c3162f332dbc88627709 Mon Sep 17 00:00:00 2001 From: Ayush Mukherjee Date: Sat, 3 Apr 2021 00:12:17 +0530 Subject: [PATCH] try and fix high cpu usage --- src/ws/crud.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ws/crud.js b/src/ws/crud.js index 9174b0a..8356509 100644 --- a/src/ws/crud.js +++ b/src/ws/crud.js @@ -92,13 +92,13 @@ const streamFns = { return await streams.find().populate('event').populate({ path: 'matches', populate: [{ path: 'orange' }, { path: 'blue' }], - }).populate('casters').populate('hosts').exec() + }).populate('casters').populate('hosts').lean().exec() }, getById: async (id) => { return await streams.findById(id).populate('event').populate({ path: 'matches', populate: [{ path: 'orange' }, { path: 'blue' }], - }).populate('casters').populate('hosts').exec() + }).populate('casters').populate('hosts').lean().exec() }, update: async(id, data) => { return await streams.findByIdAndUpdate(id, data).exec()