How to update object in Mongo with an immutable Salat case class

后端 未结 3 1120
遥遥无期
遥遥无期 2021-01-24 16:51

I\'m working on a project with Scala, Salat, Casbah, Mongo, Play2, BackboneJS... But it\'s quite a lot of new things to learn in the same time... I\'m ok with Scala but I find m

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-24 17:14

    Actually the answer is pretty simple: I didn't know there was a built-in copy method on case classes that allows to copy an immutable case class while changing some data.

    I don't have nested case class structures but the Tony Morris suggestion of using Lenses seems nice too.

提交回复
热议问题