diff --git a/apps/meteor/server/models/raw/LivechatRooms.ts b/apps/meteor/server/models/raw/LivechatRooms.ts index 8c147038c138..a421d24628c5 100644 --- a/apps/meteor/server/models/raw/LivechatRooms.ts +++ b/apps/meteor/server/models/raw/LivechatRooms.ts @@ -737,7 +737,7 @@ export class LivechatRoomsRaw extends BaseRaw implements ILive const match: Document = { $match: { 't': 'l', - 'servedBy.username': { $exists: true }, + 'servedBy._id': { $exists: true }, 'open': true, '$or': [ { @@ -771,7 +771,7 @@ export class LivechatRoomsRaw extends BaseRaw implements ILive const match: Document = { $match: { 't': 'l', - 'servedBy.username': { $exists: true }, + 'servedBy._id': { $exists: true }, 'open': true, 'onHold': { $exists: true, @@ -797,7 +797,7 @@ export class LivechatRoomsRaw extends BaseRaw implements ILive $match: { 't': 'l', 'open': { $exists: false }, - 'servedBy.username': { $exists: true }, + 'servedBy._id': { $exists: true }, 'ts': { $gte: new Date(start) }, 'closedAt': { $lte: new Date(end) }, }, @@ -1054,7 +1054,7 @@ export class LivechatRoomsRaw extends BaseRaw implements ILive 't': 'l', 'ts': { $gte: new Date(start), $lte: new Date(end) }, 'responseBy.lastMessageTs': { $exists: true }, - 'servedBy.ts': { $exists: true }, + 'servedBy._id': { $exists: true }, }, }; const group = { diff --git a/apps/meteor/server/models/raw/VoipRoom.ts b/apps/meteor/server/models/raw/VoipRoom.ts index 6ac629d807b7..34b66d4d77b5 100644 --- a/apps/meteor/server/models/raw/VoipRoom.ts +++ b/apps/meteor/server/models/raw/VoipRoom.ts @@ -137,7 +137,7 @@ export class VoipRoomRaw extends BaseRaw implements IVoipRoomModel { const query: Filter = { t: 'v', ...(visitorId && visitorId !== 'undefined' && { 'v._id': visitorId }), - ...(agents && { $or: [{ 'servedBy._id': { $in: agents } }, { 'servedBy.username': { $in: agents } }] }), + ...(agents && { 'servedBy._id': { $in: agents } }), }; if (open !== undefined) {