72 ctx, cancel := context.WithTimeout(bgCtx, 10*time.Second)
73 defer cancel()
74
75 err = mongoClient.Connect(ctx) 76 if err != nil {
77 log.Errorf("[Database][Connect]: %v", err)
78 }
62
63// dbInstance func
64func init() {
65 mongoClient, err := mongo.NewClient( 66 options.Client().ApplyURI(config.DatabaseURI),
67 )
68 if err != nil {
Sometimes a function, variable, constant, field, or whole package becomes redundant or unnecessary but must be kept for compatibility with existing programs. These should not be used except for compatibility with legacy systems.