The second ($v_2$) and third ($v_3$) flow harmonic coefficients of \jpsi\ mesons are measured at forward
rapidity (2.5~$<$~{\it y}~$<$~4.0) in Pb--Pb collisions at $\sqrt{s_{\rm NN}}$ = 5.02 TeV with the ALICE
detector at the LHC. Results are obtained with the scalar product method and
reported as a function of transverse momentum, \pt{}, for various collision centralities. A positive value of \jpsi\ $v_3$ is
observed with 3.7$\sigma$ significance. The measurements,
compared to those of
prompt D$^0$ mesons and charged particles at mid-rapidity, indicate an ordering with $v_{\rm n}$(\jpsi)~$<v_{\rm n}$(D$^0$)~$<v_{\rm n}$(h$^\pm$) (n~=~2,~3)
at low and intermediate \pt{} up to 6 GeV/$c$
and a convergence with $v_2$(\jpsi)~$\approx v_2$(D$^0$)~$\approx v_2$(h$^\pm$) at high \pt{} above 6-8 GeV/$c$.
In semi-central collisions (5--40\% and 10--50\% centrality intervals) at
intermediate \pt{} between 2 and 6 GeV/$c$, the ratio $v_3/v_2$ of \jpsi\ mesons is found to be
significantly lower (4.6$\sigma$) with respect to that of charged particles. In addition, the comparison to the prompt D$^0$-meson
ratio in the same \pt{} interval suggests an ordering similar to that of the $v_2$ and $v_3$ coefficients.
The \jpsi\ $v_2$ coefficient is further studied using the Event Shape Engineering technique.
The obtained results are found to be compatible with the expected variations of the eccentricity of the initial-state geometry.