Iron-based superconductivity emerges from the suppression of the long-ranged antiferromagnetic order in the parent compounds. To solve the microscopic mechanism of the superconductivity, the key issue is fully understanding about the evolution of magnetic interaction and its relationship between superconductivity. Here, we take the electron-doped iron-based superconductor BaFe2- x Ni x As2 as atypical example, and summarize the neutron scattering results on the electronic phase diagram, magnetic ordered state, low-energy spin excitations and high-energy spin fluctuations, particularly for their systematic evolution versus electron dopings and the recent progress on the spin nematicity. Firstly, we will introduce about the crystal structure and magnetic structure, detailed procedure of the single crystal growth is also presented. By focusing on the structural transition temperature ( T s) and magnetic transition temperature ( T N) near the optimal doping level, we have found both T s and T N vanish above the superconducting transition temperature ( T c) as a first order manner, due to the lattice distortion and magnetically ordered moment decrease beyond the lower limit of the instrument resolution, giving an avoid quantum critical point at the optimal doping. In addition, the magnetic order becomes incommensurate and short-ranged magnetic cluster and competes with superconducting order, suggesting strong interplay between magnetism and superconductivity. Secondly, we will discuss about the itinerant magnetism and spin resonance mode at low energy for spin dynamics. The spin resonance mode in iron pnictides is explained as the collective quasiparticle excitations from the Fermi surface nesting between the hole pocket at the Γ point and electron pocket at the M point. This requires itinerant magnetism from the electrons near Fermi surfaces, which is further confirmed by neutron scattering by discovering the longitudinal mode and line shape change of low-energy spin excitations upon doping. Thirdly, we will present the doping evolution of spin fluctuations throughout the whole phase diagram. Although the spin waves in the parent compound can be described by an effective Heisenberg mode with anisotropic exchange coupling in FeAs plane, the damping features and unexpected low total fluctuation moments reveal both local moments and itinerant electrons contribute to the magnetism. Upon Ni doping, the high energy spin fluctuations is very robust, but the low energy spin excitations are suppressed quickly to zero when cross the boundary of the overdoped superconducting regime. The analysis on the change of the magnetic coupling energy associated with the superconducting transition gives evidence that the magnetic fluctuations are strong enough to drive the condensation of the Cooper pairs. Fourthly, we will further introduce the recent progress on the spin anisotropy by polarized neutron scattering experiments, and spin nematicity measured on detwinned samples. Anisotropic spin excitations at low energy are discovered by polarized neutron scattering, which is caused by the in-plane orbital ordering and persists away up to the tetragonal paramagnetic state. Further experiments on the detwinned sample under uniaxial pressure give direct evidence of the spin nematicity shown as breaking C4 rotation symmetry spin excitations in the tetragonal phase, similar to the anisotropic resistivity and electronic nematic phase discovered in other probes. Such novel electron state in these materials suggests the iron pnictides are unconventional. Finally, we summarize the results about the magnetic phase transition and spin dynamics and discuss its physical origin. Then a possible picture about the spin driven unconventional superconductivity in these materials is proposed. Further perspectives on the research of magnetism in iron-based superconductivity are also given.