package mongo

import (
	"dsbqj-admin/pkg/logger"
	"github.com/kamva/mgm/v3"
	"go.mongodb.org/mongo-driver/mongo"
	"go.mongodb.org/mongo-driver/mongo/options"
)

var database *mongo.Database
var client *mongo.Client

func Database(connString string) {
	logger.Info("mongo connect starting")
	err := mgm.SetDefaultConfig(nil, "dsbqj_admin", options.Client().ApplyURI(connString))
	if err != nil {
		panic(err)
	}
	logger.Info("mongo connect success")
	return
}
