Skip to main content

Database connection

Overview

This section describes the use of the option to create a link

Preparing

  1. Complete mongo connection

WithTimeout

Sets the timeout of the mongo operation.

Example:


func NewUserModel(url, db, collection string) UserModel {
conn := mon.MustNewModel(url, db, collection, mon.WithTimeout(time.Second))
return &customUserModel{
defaultUserModel: newDefaultUserModel(conn),
}
}