Cook the spaghetti in salted water until al dente. For the sauce, fry the mushrooms in 1 tablespoon of olive oil for about 5 minutes. Remove from pan and set aside. Sauté shallot and garlic in 1 tablespoon of olive oil. Add the minced meat and sauté it. Add tomato paste and fresh tomatoes and deglaze with red wine. Add mushrooms and canned tomatoes (in pieces) with juice. Season to taste with spices. Finally stir in the flour and egg.
Drain the spaghetti and mix with the sauce. Pour into a greased baking dish. Cut the ham into coarse strips and spread on top. Grate both cheeses and sprinkle first Parmesan, then Edam cheese over the casserole. Drizzle with olive oil.
Bake in the preheated oven at 200 ° C for about 15 minutes. Sprinkle with oregano a few minutes before the end of baking time.