Scala, Casbah - How to convert List to MongoDBList?

前提是你 提交于 2019-12-10 13:58:00

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!