// NewDB returns a DB object that is not connected but is optioned correctly
NewDB returns a DB object that is not connected but is optioned correctly
// NewDB returns a DB object that is not connected but is optioned correctly
func NewDB() (*DB, error) {
	uri := "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000"
	client, err := mongo.NewClient(options.Client().ApplyURI(uri))
	if err != nil {
		panic(err)
	}
	ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
	err = client.Connect(ctx)
	if err != nil {
		panic(err)
	}
	client.Database(dbName).Collection("test").Find(context.Background(), bson.M{})
	DB := &DB{
		Client:       client,
		DatabaseName: dbName,
		BasicContext: context.Background(),
	}
	fmt.Sprintf("Starting General DB Collection Confituration")
	err = DB.ConfigureCollections()
	if err != nil {
		return nil, err
	}
	return DB, nil
}
func NewDB ( ) ( * DB , error ) { uri := " " client , err := mongo . NewClient ( options . Client ( ) . ApplyURI ( uri ) ) if err != nil { panic ( err ) } ctx , _ := context . WithTimeout ( context . Background ( ) , 10 * time . Second ) err = client . Connect ( ctx ) if err != nil { panic ( err ) } client . Database ( dbName ) . Collection ( " " ) . Find ( context . Background ( ) , bson . M { } ) DB := & DB { Client : client , DatabaseName : dbName , BasicContext : context . Background ( ) , } fmt . Sprintf ( " " ) err = DB . ConfigureCollections ( ) if err != nil { return nil , err } return DB , nil }
NewDB returns a DB object that is not connected but is optioned correctly
NewDB returns a DB object that is not connected but is optioned correctly
//uri := fmt.Sprintf("mongodb+srv://%s:%s@%s.h9r61.mongodb.net/%s?retryWrites=true&w=majority", dbUser, dbPassword, dbCluster, dbName)