MCPcopy Index your code
hub / github.com/NdoleStudio/httpsms / MongoDB

Method MongoDB

api/pkg/di/container.go:293–307  ·  view source on GitHub ↗

MongoDB creates a *mongo.Database connection to MongoDB Atlas

()

Source from the content-addressed store, hash-verified

291
292// MongoDB creates a *mongo.Database connection to MongoDB Atlas
293func (container *Container) MongoDB() *mongoDriver.Database {
294 if container.mongoDB != nil {
295 return container.mongoDB
296 }
297
298 container.logger.Debug("creating MongoDB *mongo.Database connection")
299
300 db, err := repositories.NewMongoDB(os.Getenv("MONGODB_URI"))
301 if err != nil {
302 container.logger.Fatal(err)
303 }
304
305 container.mongoDB = db
306 return container.mongoDB
307}
308
309// DBWithoutMigration creates an instance of gorm.DB if it has not been created already
310func (container *Container) DBWithoutMigration() (db *gorm.DB) {

Callers 2

HeartbeatRepositoryMethod · 0.95

Calls 2

DebugMethod · 0.65
FatalMethod · 0.65

Tested by

no test coverage detected