Folks,
Is this the most elegant way to get a scala List out of casbah?
trains
is a subkey in a doc whose value is an array
I was slightly surprised that I had to do the instanceOf
and then the asScala
to get a first class scala list
Could I have done anything better or more idiomatically scala?
val mongoconn = MongoConnection("titan"){"traininfo"}{"trains"}
val result = mongoconn.find()
println()
for{
x<-result.toList
y<-(x.get("trains").asInstanceOf[BasicDBList]).asScala
}
{
println(y);
}