Preheat the oven to 180°C and cook the lentils according to package instructions.
Toss the aubergine slices in vegetable oil and season with salt and pepper.
Fry aubergine slices in batches until golden-brown and drain on kitchen paper.
Fry the onion, pepper, and garlic until softened.
Stir in tomato purée and fry for 4-5 minutes.
Add the chopped tomatoes and cinnamon stick, then simmer for 4-5 minutes.
Add lentils and aubergines to the mixture and simmer until warmed.
Transfer filling to an ovenproof dish and garnish with parsley.
Whisk ricotta, yoghurt, eggs, and nutmeg together in a bowl and season.
Pour the topping over the filling and sprinkle with pecorino.
Bake for 25-30 minutes until the topping is golden and set.