Cut bacon into bite-sized pieces; put in frying pan. When almost done, add chopped onion and cook until tender. In a small saucepan, mix molasses, vinegar, brown sugar, and mustard, then bring to boil. Remove from heat. Place beans in a 1 1/2-quart casserole dish; add molasses mixture. Stir well. Add bacon and onion mixture, stir well. Bake for 1 hour at 325 degrees.