Documentation ¶
Index ¶
Constants ¶
View Source
const Err11000DupKeyError = 11000
Err11000DupKeyError code error for E11000.
Variables ¶
This section is empty.
Functions ¶
func Find ¶
Find executes the query in MongoDB and decode all results in dtos slice. Example: var dtos []userDTO err := mongodb.Find(ctx, props, m.collection, &dtos).
func IsDuplKeyError ¶
IsDuplKeyError detects if the error is a E11000 duplicate key error.
Types ¶
type MongoDB ¶
type MongoDB struct {
// contains filtered or unexported fields
}
MongoDB will manage the connection with the database.
func NewMongoDB ¶
NewMongoDB is a constructor function.
func (*MongoDB) Connect ¶
Connect open a database connection and check if it is connecting using ping.
func (*MongoDB) Disconnect ¶
func (m *MongoDB) Disconnect()
Disconnect closes the connection with the database.
Click to show internal directories.
Click to hide internal directories.