Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
marvzhang
2020-01-06 12:36:30 +08:00

View File

@@ -93,5 +93,14 @@ func InitMongo() error {
// 赋值给全局mongo session
Session = sess
}
//Add Unique index for 'key'
keyIndex := mgo.Index{
Key: []string{"key"},
Unique: true,
}
s, c := GetCol("nodes")
defer s.Close()
c.EnsureIndex(keyIndex)
return nil
}