From 6a744c96e5bdde9baa532070d4d6a4ba37b3c582 Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Mon, 4 Dec 2023 19:41:40 -0500 Subject: [PATCH 1/2] add index to workspace to improve query --- backend/src/models/machineMembership.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/models/machineMembership.ts b/backend/src/models/machineMembership.ts index ab0859e8d..2463009b3 100644 --- a/backend/src/models/machineMembership.ts +++ b/backend/src/models/machineMembership.ts @@ -18,7 +18,8 @@ const machineMembershipSchema = new Schema( workspace: { type: Schema.Types.ObjectId, ref: "Workspace", - required: true + required: true, + index: true, }, role: { type: String, From d257a449bb3d603088fca151e6db210336d6a7ec Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Mon, 4 Dec 2023 19:42:09 -0500 Subject: [PATCH 2/2] add compound index to machineIdentityClientSecretDataSchema --- backend/src/models/machineIdentityClientSecretData.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/models/machineIdentityClientSecretData.ts b/backend/src/models/machineIdentityClientSecretData.ts index 9bdf950bb..fbcd46606 100644 --- a/backend/src/models/machineIdentityClientSecretData.ts +++ b/backend/src/models/machineIdentityClientSecretData.ts @@ -71,4 +71,8 @@ const machineIdentityClientSecretDataSchema = new Schema( } ); +machineIdentityClientSecretDataSchema.index( + { machineIdentity: 1, isActive: 1 } +) + export const MachineIdentityClientSecretData = model("MachineIdentityClientSecretData", machineIdentityClientSecretDataSchema); \ No newline at end of file