Recent research efforts on the nanostructural control of MgB2 by doping various nanoparticles including Ti, nano-diamond, and Ho2O3, and their effects on flux pinning behavior of MgB2 are summarized and analyzed. These nanodopants have different chemical and physical properties, thus bring about different pinning efficiency, especially nanodopants with strong magnetic moment are particularly interesting as pinning centers in MgB2 since magnetic impurities usually have a stronger interaction with magnetic flux line than nonmagnetic impurities and may exert a stronger force to trap the flux lines when they are properly introduced into the superconducting matrix.