Skip to content

Instantly share code, notes, and snippets.

@bhudgeons
Created October 8, 2012 21:39
Show Gist options
  • Save bhudgeons/3855170 to your computer and use it in GitHub Desktop.
Save bhudgeons/3855170 to your computer and use it in GitHub Desktop.
Casbah 3.0 MongoDBList Strangeness
scala> import com.mongodb.casbah._
import com.mongodb.casbah._
scala> val dbl = MongoDBList()
16:23:48.222 [Thread-35] DEBUG c.m.c.c.c.s.package$RegisterConversionHelpers$ - Registering Scala Conversions.
16:23:48.225 [Thread-35] DEBUG c.m.c.c.c.s.package$RegisterConversionHelpers$ - Deserializers for Scala Conversions registering
16:23:48.226 [Thread-35] DEBUG c.m.c.c.c.s.package$RegisterConversionHelpers$ - Serializers for Scala Conversions registering
16:23:48.227 [Thread-35] DEBUG c.m.c.c.c.s.package$RegisterConversionHelpers$ - Setting up OptionSerializer
16:23:48.232 [Thread-35] DEBUG c.m.c.c.c.s.package$RegisterConversionHelpers$ - Setting up ScalaJCollectionSerializer
16:23:48.238 [Thread-35] DEBUG c.m.c.c.c.s.package$RegisterConversionHelpers$ - Setting up ScalaRegexSerializers
16:23:48.238 [Thread-35] DEBUG c.m.c.c.c.s.package$RegisterConversionHelpers$ - Hooking up scala.util.matching.Regex serializer
16:23:48.239 [Thread-35] DEBUG c.m.c.c.c.s.package$RegisterConversionHelpers$ - Reached base registration method on MongoConversionHelper.
dbl: scala.collection.mutable.Seq[Any] = [ ]
scala> def f(ml:MongoDBList) = {}
f: (ml: com.mongodb.casbah.package.MongoDBList)Unit
scala> f(dbl)
<console>:13: error: type mismatch;
found : scala.collection.mutable.Seq[Any]
required: com.mongodb.casbah.package.MongoDBList
f(dbl)
^
scala> import com.mongodb.BasicDBList
import com.mongodb.BasicDBList
scala> val dbl2 = new BasicDBList
dbl2: com.mongodb.BasicDBList = [ ]
scala> f(dbl2) // no error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment