func InitDB() {
	client, err := mongo.Connect(context.Background(), config())
	if err != nil {
		log.Fatal(err)
		panic("mongoDB connection error")
	}
	err = client.Ping(context.Background(), nil)
	if err != nil {
		log.Fatal(err)
		panic("mongoDB connection error")
	}
	fmt.Println("Connected to MongoDB")

	db = client.Database(dbName)
	collectionPost = db.Collection(collectionName)
}
// InitDB Initialize Database (Connection)
InitDB Initialize Database (Connection)
// InitDB Initialize Database ( Connection )
func InitDB() {
	client, err := mongo.Connect(context.Background(), config())
	if err != nil {
		log.Fatal(err)
		panic("mongoDB connection error")
	}
	err = client.Ping(context.Background(), nil)
	if err != nil {
		log.Fatal(err)
		panic("mongoDB connection error")
	}
	fmt.Println("Connected to MongoDB")
	db = client.Database(dbName)
	collectionPost = db.Collection(collectionName)
}
func InitDB ( ) { client , err := mongo . Connect ( context . Background ( ) , config ( ) ) if err != nil { log . Fatal ( err ) panic ( " " ) } err = client . Ping ( context . Background ( ) , nil ) if err != nil { log . Fatal ( err ) panic ( " " ) } fmt . Println ( " " ) db = client . Database ( dbName ) collectionPost = db . Collection ( collectionName ) }
InitDB Initialize Database (Connection)
InitDB Initialize Database ( Connection )