Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala, Casbah - How to convert List to MongoDBList?

Tags:

scala

casbah

Is there an easy way to turn List into MongoDBList(or BasicDBList) ?

like image 453
un1t Avatar asked Mar 03 '13 17:03

un1t


1 Answers

scala>  val list = List("foo", "bar")
list: List[java.lang.String] = List(foo, bar)

scala>  val dbList = MongoDBList(list:_*)
dbList: com.mongodb.casbah.commons.MongoDBList = [ "foo" , "bar"]

Hint: always read source code at first. It can provide many answers to your questions and will be useful BTW. It may be hard at first time, but then it became more and more natural.

like image 195
Sergey Passichenko Avatar answered Nov 10 '22 00:11

Sergey Passichenko