mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-08-24 22:59:52 +08:00
model
This commit is contained in:
parent
727bf623b3
commit
3e0c6f94ed
@ -58,6 +58,10 @@ func initMongo() *mongo.Client {
|
|||||||
panic(err.Error() + " mongo.Connect failed " + uri)
|
panic(err.Error() + " mongo.Connect failed " + uri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return mongoClient
|
||||||
|
}
|
||||||
|
|
||||||
|
func CreateAllIndex(mongoClient *mongo.Client) {
|
||||||
// mongodb create index
|
// mongodb create index
|
||||||
if err := createMongoIndex(mongoClient, cSendLog, false, "send_id", "-send_time"); err != nil {
|
if err := createMongoIndex(mongoClient, cSendLog, false, "send_id", "-send_time"); err != nil {
|
||||||
panic(err.Error() + " index create failed " + cSendLog + " send_id, -send_time")
|
panic(err.Error() + " index create failed " + cSendLog + " send_id, -send_time")
|
||||||
@ -80,7 +84,6 @@ func initMongo() *mongo.Client {
|
|||||||
if err := createMongoIndex(mongoClient, cTag, true, "tag_id"); err != nil {
|
if err := createMongoIndex(mongoClient, cTag, true, "tag_id"); err != nil {
|
||||||
panic(err.Error() + "index create failed " + cTag + " tag_id")
|
panic(err.Error() + "index create failed " + cTag + " tag_id")
|
||||||
}
|
}
|
||||||
return mongoClient
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func createMongoIndex(client *mongo.Client, collection string, isUnique bool, keys ...string) error {
|
func createMongoIndex(client *mongo.Client, collection string, isUnique bool, keys ...string) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user