I've just read this post on how to use composite keys with Salat and MongoDB... and it is more or less clear how it works. Nevertheless, I'm wondering if the @Key
annotation is mandatory even if my key is already named id
. I'm trying to serialize a few case classes coming from an external library and I'd prefer not to redefine them. Given the following external case classes:
case class UserId(id: String, mail: String)
case class User(id: UserId, name: String, surname: String)
Would it be possible to serialize an User
object like this (i.e. without the @Key
annotation)?
object UserDAO extends SalatDAO[User, UserId](...)
Thanks.