The formula for Magnesium Nitride?

I know the formula for Magnesium nitride is Mg_3N_2 but why? On my test I put Mg(NO)_2 which was wrong. The charge for MG is 2+ and N is 3- and isn't nitiride NO2? I'm confused..
I suck at chemistry..
4 answers 4