From 295b94b3b535d6ede3544fca75d90181e3b59f61 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Mon, 28 Oct 2024 11:20:49 -0300 Subject: [PATCH] better index --- apps/meteor/server/models/raw/LivechatRooms.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/meteor/server/models/raw/LivechatRooms.ts b/apps/meteor/server/models/raw/LivechatRooms.ts index 5d41241f7c3d..87523a733fd1 100644 --- a/apps/meteor/server/models/raw/LivechatRooms.ts +++ b/apps/meteor/server/models/raw/LivechatRooms.ts @@ -54,10 +54,7 @@ export class LivechatRoomsRaw extends BaseRaw implements ILive { key: { servedBy: 1 }, sparse: true }, { key: { 'v.token': 1, 'email.thread': 1 }, sparse: true }, { key: { 'v._id': 1 }, sparse: true }, - // { key: { 't': 1, 'fname': 1, 'servedBy._id': 1, 'onHold': 1 } }, // created with username - // { key: { 't': 1, 'ts': -1, 'servedBy._id': 1, 'onHold': 1 } }, - // { key: { 't': 1, 'closedAt': -1, 'servedBy._id': 1, 'onHold': 1 } }, - { key: { 'onHold': 1, 'ts': -1, 'servedBy._id': 1, 't': 1 } }, + { key: { 'servedBy._id': 1, 'departmentId': 1, 't': 1, 'open': 1, 'ts': -1 } }, { key: { t: 1, departmentId: 1, closedAt: 1 }, partialFilterExpression: { closedAt: { $exists: true } } }, { key: { source: 1 }, sparse: true }, { key: { departmentAncestors: 1 }, sparse: true }, @@ -1336,6 +1333,9 @@ export class LivechatRoomsRaw extends BaseRaw implements ILive query.onHold = { $ne: true }; } + console.log('query ->', query); + console.log('options.sort ->', options.sort); + return this.findPaginated(query, { sort: options.sort || { name: 1 }, skip: options.offset,