The molecular geometry of a compound can be seen as the true shape of that molecule, or compound that takes into account differences in repulsion between lone pairs and surrounding elements. Now because of this, we would treat lone pairs on the central element and surrounding elements as different, so they're not going to be treated as the same.
Now we're going to take a look at each of the number of electron groups that exist, starting out with two electron groups. Now when we have two electron groups, we're going to say here this is central elements with two electron groups that have 0 lone pairs and give only one possible molecular geometry.
So if we take a look here we have two electron groups. We say that there are zero loan pairs, so that means we're going to have two bonding groups possible. Remember bonding groups are just your surrounding elements, 0 lone pairs. Here are some examples and all of them we have a central element here we have beryllium, carbon and carbon again and they are connected to only two surrounding elements.
Now it doesn't matter if it's single bonded to them or double bonded or triple bonded, it's still 2 surrounding elements or two bonding groups visually would see it as our black spear here, which is our central element connected to those grey spheres which are surrounding elements here. The molecular geometry for all of them would be linear.
So when it comes to two electron groups around the central element, there's only one possible molecular geometry, and that's a linear molecular geometry.