Merge 6f15f072d09c89815f24f7103918091d16fa8105 into 715c18ef5f647926a4e41bab5731ea35e132e35d

This commit is contained in:
WhereAreBugs 2026-09-01 07:23:51 +05:30 committed by GitHub
commit 091a0d927b
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),
})