// We need this object to establish a session to our MongoDB. mongoDBDialInfo := &mgo.DialInfo{ Addrs: []string{MongoDBHosts}, Timeout: 60 * time.Second, Database: AuthDatabase, Username: AuthUserName, Password: AuthPassword, } // Create a session which maintains a pool of socket connections // to our MongoDB. mongoSession, err := mgo.DialWithInfo(mongoDBDialInfo) if err != nil { log.Fatalf("CreateSession: %s\n", err) }