From 19f19939a1f4d9a9fb12d297cd25ee74a2593cf0 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Wed, 11 Dec 2024 12:17:25 +0800 Subject: [PATCH] fix: duplicated index recreation --- core/models/common/index_utils.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/models/common/index_utils.go b/core/models/common/index_utils.go index 0a0028a2..ff0fd061 100644 --- a/core/models/common/index_utils.go +++ b/core/models/common/index_utils.go @@ -59,8 +59,9 @@ func normalizeIndexKey(key interface{}) string { pairs = append(pairs, fmt.Sprintf("%q:%v", elem.Key, elem.Value)) } - res, _ := bson.Marshal(pairs) - return string(res) + pairsBytes, _ := json.Marshal(pairs) + pairsStr := string(pairsBytes) + return pairsStr } func RecreateIndexes(col *mongo.Col, desiredIndexes []mongo2.IndexModel) {