How to use this connection in other go files MongoDB?

Export this connection and call it from other files.
im using go-bongo a ODM

func Conn(){
  config := &bongo.Config{
    ConnectionString: "mongodb://go:fake@ds117523.mlab.com:17542/golangfake",
    Database:         "golang",
    }
    connection, _ := bongo.Connect(config)
 }

call that function.

func main(){
    Conn.connection //something like this
}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.