From 70f5c58d55de00714dc8fd6b1bea5f33b73dbf30 Mon Sep 17 00:00:00 2001 From: Ayush Sharma Date: Fri, 31 Jan 2025 07:54:43 +0530 Subject: [PATCH] fix: duplicate name key err for probes Signed-off-by: Ayush Sharma --- .../graphql/server/pkg/database/mongodb/init.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/chaoscenter/graphql/server/pkg/database/mongodb/init.go b/chaoscenter/graphql/server/pkg/database/mongodb/init.go index 1f568f483b6..36a1feacbbe 100644 --- a/chaoscenter/graphql/server/pkg/database/mongodb/init.go +++ b/chaoscenter/graphql/server/pkg/database/mongodb/init.go @@ -277,16 +277,12 @@ func (m *MongoClient) initAllCollection() { m.ChaosProbeCollection = m.Database.Collection(Collections[ChaosProbeCollection]) _, err = m.ChaosProbeCollection.Indexes().CreateMany(backgroundContext, []mongo.IndexModel{ - { - Keys: bson.M{ - "name": 1, - }, - Options: options.Index().SetUnique(true), - }, { Keys: bson.D{ - {"project_id", 1}, + {Key: "name", Value: 1}, + {Key: "project_id", Value: 1}, }, + Options: options.Index().SetUnique(true), }, }) if err != nil {