From 6c831080fdf58b349f5214ab8cc1b8c7a923ce43 Mon Sep 17 00:00:00 2001 From: Youngteac Hong Date: Wed, 11 Dec 2024 14:48:52 +0900 Subject: [PATCH] Simplify unique constraint for documents --- server/backend/database/mongo/indexes.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/server/backend/database/mongo/indexes.go b/server/backend/database/mongo/indexes.go index 2af28b84a..d4d433cea 100644 --- a/server/backend/database/mongo/indexes.go +++ b/server/backend/database/mongo/indexes.go @@ -111,12 +111,9 @@ var collectionInfos = []collectionInfo{ Keys: bsonx.Doc{ {Key: "project_id", Value: bsonx.Int32(1)}, // shard key {Key: "key", Value: bsonx.Int32(1)}, + {Key: "removed_at", Value: bsonx.Int32(1)}, }, - Options: options.Index().SetPartialFilterExpression( - bsonx.Doc{ - {Key: "removed_at", Value: bsonx.Null()}, - }, - ).SetUnique(true), + Options: options.Index().SetUnique(true), }}, }, { name: ColChanges,