斯卡拉 – 用卡斯巴的正则表达式找到
发布时间:2020-12-14 06:24:22 所属栏目:百科 来源:网络整理
导读:如何在Collection#find(/ * HERE * /)中使用正则表达式,如: val coll = MongoConnection()("foo")("bar")for(x - coll.find("name" - ".*son$".r)) { // some operations...} 你很接近,你只需要在MongoDBObject()中包装你的条件. 我们不得不提取 key的隐式
如何在Collection#find(/ * HERE * /)中使用正则表达式,如:
val coll = MongoConnection()("foo")("bar") for(x <- coll.find("name" -> ".*son$".r)) { // some operations... }
你很接近,你只需要在MongoDBObject()中包装你的条件.
我们不得不提取< key>的隐式转换. – > <值GT;在一堆地方,因为他们很难正确抓住并打破其他代码. 他们可能会回到2.1. 改为: val coll = MongoConnection()("foo")("bar") for(x <- coll.find(MongoDBObject("name" -> ".*son$".r))) { // some operations... } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |