mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-30 02:44:05 +08:00
bugfix(conversation):remove unexpected unique index.
This commit is contained in:
parent
86b05e16b6
commit
332c4b152c
@ -32,19 +32,26 @@ import (
|
|||||||
|
|
||||||
func NewConversationMongo(db *mongo.Database) (*ConversationMgo, error) {
|
func NewConversationMongo(db *mongo.Database) (*ConversationMgo, error) {
|
||||||
coll := db.Collection(database.ConversationName)
|
coll := db.Collection(database.ConversationName)
|
||||||
_, err := coll.Indexes().CreateMany(context.Background(), []mongo.IndexModel{{
|
_, err := coll.Indexes().CreateMany(context.Background(), []mongo.IndexModel{
|
||||||
Keys: bson.D{
|
{
|
||||||
{Key: "owner_user_id", Value: 1},
|
Keys: bson.D{
|
||||||
{Key: "conversation_id", Value: 1},
|
{Key: "owner_user_id", Value: 1},
|
||||||
|
{Key: "conversation_id", Value: 1},
|
||||||
|
},
|
||||||
|
Options: options.Index().SetUnique(true),
|
||||||
},
|
},
|
||||||
Options: options.Index().SetUnique(true),
|
{
|
||||||
}, {
|
Keys: bson.D{
|
||||||
Keys: bson.D{
|
{Key: "user_id", Value: 1},
|
||||||
{Key: "conversation_id", Value: 1},
|
},
|
||||||
|
Options: options.Index(),
|
||||||
},
|
},
|
||||||
Options: options.Index().SetUnique(true),
|
{
|
||||||
}},
|
Keys: bson.D{
|
||||||
)
|
{Key: "conversation_id", Value: 1},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errs.Wrap(err)
|
return nil, errs.Wrap(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user