Merge 6f15f072d09c89815f24f7103918091d16fa8105 into 5211d43d9d86772a45b451e49d526400a4e0448e

This commit is contained in:
WhereAreBugs 2026-03-28 00:43:35 +00:00 committed by GitHub
commit e6894e60ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -20,7 +20,6 @@ import (
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/database"
"github.com/openimsdk/open-im-server/v3/pkg/common/storage/model"
"github.com/openimsdk/tools/db/mongoutil"
"github.com/openimsdk/tools/errs"
"go.mongodb.org/mongo-driver/bson"
@ -31,10 +30,11 @@ import (
func NewS3Mongo(db *mongo.Database) (database.ObjectInfo, error) {
coll := db.Collection(database.ObjectName)
// Create index for name
// Create new unique index for name + engine
_, err := coll.Indexes().CreateOne(context.Background(), mongo.IndexModel{
Keys: bson.D{
{Key: "name", Value: 1},
{Key: "engine", Value: 1},
},
Options: options.Index().SetUnique(true),
})