Peel and finely dice the shallot and garlic. Heat the oil in a frying pan and sauté the shallot and onion mixture in it. Add the minced meat and fry briefly. Season with salt and pepper.
Add the tomatoes and simmer for about 10 minutes. Meanwhile cook spaghetti in boiling salted water for about 8 minutes until al dente. Drain the beans and add them to the sauce about 1 minute before the end of the cooking time.
Add cumin and about half of the pistachios. Drain the spaghetti and mix it with the sauce, not too dry. Arrange on plates and sprinkle with the remaining pistachios.