scala - convert byte[] to case class instance
<p>I stored one of my case class instance 'Alert' as binary in mongoDB.
I have to read and type cash to 'Alert'.</p>

<p>I tried this</p>

<pre><code>object MongoMain extends App {
val uri = new MongoURI("url")
  val mongoColl = MongoConnection(uri)("testdb")("alert")
  val q = MongoDBObject("_id" -&gt; ObjectId.massageToObjectId("5269c718ebb2e54b950a1cc1"))
  //  println(mongoColl.findOne(q))
  mongoColl.find(q).foreach { z ⇒
    z.get("message").getClass match {
      case data: Class[Binary] ⇒ println(data.getSimpleName)
      case _                   ⇒
    }
  }
}
</code></pre>

<p>This printing byte[], ie, it retriving message field as byte[] after I have to convert it to Alert. how can I do that, need help:</p>