Cook the spaghetti according to the instructions. In the meantime, cut the mushrooms into slices; then sauté in the butter with the onion cut into small cubes. Pour in some cognac and the cream. Add the cream cheese and let it melt while stirring. Season with salt and pepper to taste. Drain the spaghetti in a sieve, arrange on plates and spread the mushroom sauce on top. Rub the parmesan cheese over the top if you like.