Fry bacon in a skillet until slightly golden. Add onions and garlic and cook for 1 minute.
Drain beans and add to bacon mixture. Stir to combine.
Combine molasses, mustard, ketchup, salt and pepper in 3 or 4 cups of water and pour over beans. Combine and add more water to cover beans. Bring to a boil. Lower heat and continue cooking at low temperature for 4 hours.
Another way to cook the beans is to bake them. After bringing them to a boil for the first time, instead of lowering the heat and continue cooking on the stove, transfer beans to oven and bake them in a preheated oven to 300ºF (150ºC) for 4 to 6 hours. In both cases water may be added during cooking, if necessary. Stir occasionally to prevent beans from sticking to the pan.
Beans will be ready when they are soft and the sauce is thick.