mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-29 05:38:45 +08:00
index fix
This commit is contained in:
parent
9964650014
commit
7dc1f9b81b
@ -192,11 +192,19 @@ func createMongoIndex(client *mongo.Client, collection string, isUnique bool, ke
|
|||||||
keysDoc = keysDoc.Append(key, bsonx.Int32(1))
|
keysDoc = keysDoc.Append(key, bsonx.Int32(1))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var index mongo.IndexModel
|
||||||
// 创建索引
|
if utils.IsContain("uid", keys) {
|
||||||
index := mongo.IndexModel{
|
name := "uid_new"
|
||||||
|
index = mongo.IndexModel{
|
||||||
|
Keys: keysDoc,
|
||||||
|
Options: &options.IndexOptions{Name: &name},
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
index = mongo.IndexModel{
|
||||||
Keys: keysDoc,
|
Keys: keysDoc,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if isUnique == true {
|
if isUnique == true {
|
||||||
index.Options = options.Index().SetUnique(true)
|
index.Options = options.Index().SetUnique(true)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user