Find by Regular Expression with Kasbach

how to use regular expressions in Collection#find(/* HERE */) like:

 val coll = MongoConnection()("foo")("bar") for(x <- coll.find("name" -> ".*son$".r)) { // some operations... } 
+7
source share
1 answer

You're close, you just need to wrap your conditions in MongoDBObject() .

We had to pull the implicit <key> -> <value> conversions into a bunch of places because they were hard to catch correctly and violated other code.

They will probably be back in 2.1.

Do this instead:

 val coll = MongoConnection()("foo")("bar") for(x <- coll.find(MongoDBObject("name" -> ".*son$".r))) { // some operations... } 
+14
source

All Articles