literally, it's "all the world" I think that should be accepted, my understanding is that saying "todo el mundo" is a hyperbolic way of saying "everyone" like here the person seems shocked at how many people were invited (hence the exclamation points) But I'm not a native speaker, so I could be wrong.
I wonder if I would be correct if I answered " They invited the whole world" this really amuses me
why is this 'everyone' but "toda la familia" means 'the whole family'? Why does this phrase not translate to 'the whole world'?
It does translate to "the whole world" too, but generally it's an idiom meaning "everybody".
Still I think the whole world should be accepted here because you could also say that idiomatically in English and people would understand that you mean everybody and their mother.
"Everybody" does not mean all the hands and legs and heads and pancreases and other body parts; it means everybody. In the same sense, todo el mundo is not used for the whole world; it's used where an English speaker would say "everyone" or "everybody". If you really want to talk about the whole world, use el mundo entero.
I think it's idiomatic, like we say "every man and his dog" (maybe that's just an Aussie expression)