如何使用mongo-scala-driver保存Set?

时间:2017-08-24 11:22:18

标签: mongodb scala mongo-scala-driver

我尝试使用Set类型的字段保存案例类。 像这样:

case class MyObject(setOfString:Set[String]) 

当我从db获取MyObject时,我有这个错误:

The future returned an exception of type: java.lang.ClassCastException, with message: scala.collection.immutable.$colon$colon cannot be cast to scala.collection.immutable.Set.

Mongo版本:

"org.mongodb.scala"      %%  "mongo-scala-driver"     % "2.1.0"

任何想法如何强制将类型设置为mongo驱动程序?

0 个答案:

没有答案
相关问题