From 83d92701b007b48e3eac719ca52a0d0bf71a8960 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrique=20Guimar=C3=A3es=20Ribeiro?=
 <henrique.jobs1@gmail.com>
Date: Wed, 3 Jul 2024 15:34:30 -0300
Subject: [PATCH] regression: Fix new user panel memory exceeded error (#32696)

---
 .changeset/dull-knives-complain.md      | 5 +++++
 apps/meteor/app/api/server/lib/users.ts | 1 +
 2 files changed, 6 insertions(+)
 create mode 100644 .changeset/dull-knives-complain.md

diff --git a/.changeset/dull-knives-complain.md b/.changeset/dull-knives-complain.md
new file mode 100644
index 00000000000..02bfe810eae
--- /dev/null
+++ b/.changeset/dull-knives-complain.md
@@ -0,0 +1,5 @@
+---
+"@rocket.chat/meteor": patch
+---
+
+Added the allowDiskUse option to the users page queries so that if the mongodb memory threshold is exceeded it will use disk space instead of throwing an error.
diff --git a/apps/meteor/app/api/server/lib/users.ts b/apps/meteor/app/api/server/lib/users.ts
index a912043fc65..f8e3d528f16 100644
--- a/apps/meteor/app/api/server/lib/users.ts
+++ b/apps/meteor/app/api/server/lib/users.ts
@@ -205,6 +205,7 @@ export async function findPaginatedUsersByStatus({
 			skip: offset,
 			limit: count,
 			projection,
+			allowDiskUse: true,
 		},
 	);
 	const [users, total] = await Promise.all([cursor.toArray(), totalCount]);
-- 
GitLab