Prepare the ingredients: Cut the mushrooms into 1/4-inch (5mm) slices (cut bigger mushrooms in half and then into slices). Chop the shallots, finely chop the garlic. Wash thoroughly spinach and chop it roughly into smaller pieces. Shred the cheese on the large holes of a box grater.
Heat 1 tablespoon of oil in a large frying pan over medium-low heat. Add the shallots, cook for 2-3 minutes until soft. Add the garlic and thyme, cook for 30 seconds. Transfer the onion with garlic to a large bowl.
Heat another 1 tablespoon of oil over high heat, add 1/2 of the mushrooms in an even layer. Don't stir for the first 1-2 minutes then stir from time to time and cook the mushrooms until the water is evaporated and the mushrooms are browned. Repeat with the remaining mushrooms. Transfer the mushrooms to the bowl with onions.
Add the spinach to the pan and cook it briefly until lightly wilted. Transfer to the bowl.
Add the shredded cheese to the bowl, season the filling with salt and pepper, stir until combined.