I am new to mongoDB, so this may be a really stupid question...
I am trying to access a rails mongo session store from scala.
val sessions = MongoConnection("localhost", 27017)("databaseName")("sessions")
val session = sessions.findOneById("1qzyxraa27shwq2qctkon44fl")
If I print the session, it looks like this:
Some({ "data" : <Binary Data> , "_id" : "1qzyxraa27shwq2qctkon44fl" , "updated_at" : { "$date" : "2013-05-09T04:58:21.054Z"} , "created_at" : { "$date" : "2013-05-09T04:58:21.054Z"}})
If I print the updated_at
field:
val updatedAt = session.get("updated_at")
Thu May 09 00:58:21 EDT 2013
The field I am interested in is the data field:
val data = session.get("data")
Problem is, I am not sure really what to do with this, I can't convert it to a string or seem to cast it to anything I've tried.
In the db if I find it manually, the field shows up as:
BinData(0,"BAh7BkkiEF9jc3JmX3Rva2VuB......")
And I am able to process that base64 string manually but how do I get something I can process with casbah?