I have a case class with a 2-dimensional array stored in a MongoDB, because Salat does not support Arrays I'm trying to write my own converters.
case class Matrix(id: String, matr: Array[Array[Int]])
implicit def toDBObject(m: Matrix) = MongoDBObject(
"id" -> m.id,
"matr" -> s.matr
)
implicit def toMatr(in: MongoDBObject) = Matrix(
in.as[String]("id"),
in.as[Array[Array[Int]]]("matr") // This does not work
)
toDBObject
works fine, but the toMatr
is not working. How can I make this work?