From a8a28724f3948a911e9103b73386b5acd2638b72 Mon Sep 17 00:00:00 2001 From: Sarthak Jain Date: Thu, 15 Feb 2024 18:14:06 +0530 Subject: [PATCH] updated the environment_id index to be a partia index (#4436) Signed-off-by: Sarthak Jain Co-authored-by: Amit Kumar Das Co-authored-by: Saranya Jena --- chaoscenter/graphql/server/pkg/database/mongodb/init.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chaoscenter/graphql/server/pkg/database/mongodb/init.go b/chaoscenter/graphql/server/pkg/database/mongodb/init.go index 1a6183df5c7..1f568f483b6 100644 --- a/chaoscenter/graphql/server/pkg/database/mongodb/init.go +++ b/chaoscenter/graphql/server/pkg/database/mongodb/init.go @@ -256,7 +256,9 @@ func (m *MongoClient) initAllCollection() { Keys: bson.M{ "environment_id": 1, }, - Options: options.Index().SetUnique(true), + Options: options.Index().SetUnique(true).SetPartialFilterExpression(bson.D{{ + "is_removed", false, + }}), }, { Keys: bson.M{