问题
Is there an easy way to turn List into MongoDBList(or BasicDBList) ?
回答1:
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.
来源:https://stackoverflow.com/questions/15188605/scala-casbah-how-to-convert-list-to-mongodblist