pull/3674/merge
神奇bug在哪里 4 days ago committed by GitHub
commit 28ad2bc943
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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),
})

Loading…
Cancel
Save