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://",
    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.