// NewConnection establishes a new session to the database.
NewConnection establishes a new session to the database.
// NewConnection establishes a new session to the database .
func NewConnection(c *config.Database) (MgoSession, error) {
	info, err := mgo.ParseURL(BuildConnString(c))
	if err != nil {
		return nil, err
	}
	info.Timeout = 10 * time.Second
	session, err := mgo.DialWithInfo(info)
	if err == nil {
		session.SetSyncTimeout(1 * time.Minute)
		session.SetSocketTimeout(1 * time.Minute)
	}
	return session, err
}
func NewConnection ( c * config . Database ) ( MgoSession , error ) { info , err := mgo . ParseURL ( BuildConnString ( c ) ) if err != nil { return nil , err } info . Timeout = 10 * time . Second session , err := mgo . DialWithInfo ( info ) if err == nil { session . SetSyncTimeout ( 1 * time . Minute ) session . SetSocketTimeout ( 1 * time . Minute ) } return session , err }
NewConnection establishes a new session to the database.
NewConnection establishes a new session to the database .