how to pivot data using spring-data-mongodb

2019-04-02 15:29发布

问题:

I have data of this form and I referred to this link pivoting in mongodb:

    Name, SumPrice, type,year 
     A,    50.0,     Retail,2015
     B,    467.0,    Online,2015
     A,    1456.0,   Direct,2015
     B,    1149.53,  Direct,2015
     C,     273.20,  Online,2014
     C,     110.0,   Direct,2014

I want data to be transformed using spring-data-mongodb of this form

     Name ,Retail, Online , Direct, year
      A,     50.0 ,  0.0,    1456.0     2015
      B,     0.0,    467.0,  1149.53,  2015
      C,     0.0,    273.20, 110.0,     2014

Please lemme know how to do.

Regards

kris