Fill a large pot with lightly salted water and bring to a rolling boil over high heat. Once the water is boiling, stir in the spaghetti, and return to a boil. Cook the pasta uncovered, stirring occasionally, until the pasta has cooked through, but is still firm to the bite, about 12 minutes. Drain well in a colander set in the sink. While the pasta is cooking, brown the bacon with onion in a large pan over medium heat until the bacon is almost crisp, about 10 minutes; drain excess fat, and stir in the mushrooms and tomato sauce. Bring the sauce to a boil. Return the cooked spaghetti to the pot, mix with sauce, and serve.