Bring a large pot of salted water to a boil. Add the spaghetti and cook according to package instructions until al dente. In the last 2 minutes of cooking, add the peas to the pot. Reserve 1 cup of pasta water, then drain the spaghetti and peas.
In a large skillet over medium heat, cook the pancetta or bacon until crispy, about 5-7 minutes. Add the minced garlic and sauté for an additional minute until fragrant.
In a bowl, whisk together the eggs and grated Parmesan cheese until well combined. Season with salt and black pepper.
Add the drained spaghetti and peas to the skillet with the pancetta. Remove the skillet from heat. Quickly pour the egg and cheese mixture over the pasta, tossing to coat. If the sauce is too thick, add reserved pasta water a little at a time until you reach your desired consistency.
Serve immediately, garnished with chopped parsley if desired.