fix: duplicated index recreation

This commit is contained in:
Marvin Zhang
2024-12-11 12:17:25 +08:00
parent 2a54762249
commit 19f19939a1

View File

@@ -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) {