I stumbled about the same problem.
I don't understand why this should be "the end". Are their technical problems?
The thing is it work sperfectly saving all that stuff withouth errors, even retrieving it. But it looks like behind the scenes the keys are strings, even for the scala maps.
The MongoDB part is clear, but the side how salat handles it I don't understand.
I will show you my case class:
case class Region (
id: ObjectId = new ObjectId,
name: String,
recomDuration : Option[DurationMinMax] = None,
dailyBudget : Option[Budget] = None,
textualDescription: Option[String] = None,
recomPeriod : Map[Month.Value,Double] = Map(),
travelerTypeFit : Map[TravelerType.Value, Double] = Map(),
@Key("country_ids")countries: Set[ObjectId] = Set.empty,
@Key("parentRegion_id")parentRegion: Option[ObjectId] = None,
@Key("neighbour_ids")neighbourRegions : Set[ObjectId] = Set.empty,
isActive : Boolean = false
) extends LabeledToStringDef
Writing "recomPeriod" like that works perfectly. Reading also looks right.
But things get wrong when I try to retrieve things with equality checks.
I figured out why that is:
The following gives me "String" as a type:
println("map keys type: " + parentRegion.recomPeriod.keySet.toList(0).getClass())
whereas I suspect it to be Month.Value (or actually: scala.Enumeration$Val)
I don't wanna loose my type-safety with that Map, which is anyways String-based (although it is a Enum).
The enum looks like this:
object Month extends Enumeration {
type Month = Value
val January = Value("january")
val Feburary = Value("february")
val March = Value("march")
val April = Value("april")
val May = Value("may")
val June = Value("june")
val July = Value("july")
val August = Value("august")
val September = Value("september")
val October = Value("october")
val November = Value("november")
val December = Value("december")
val options2 = values.toList.map(value => (value.toString -> value.toString.capitalize)).toSeq
}
Any help is appreciated. Thanks,
Michael