简体   繁体   中英

mongodb querying regex with casbah fluid syntax

I am having an issue with querying against a regex with fluid dsl syntax, i am trying to say something like ("id" -> foo) using fluid. foo is a regex, so there is no $elemMatch on regex so I am getting "No implicit view available from Regex to DBObject".

so, currently i have to structure my query in the following way:

("someval" $gte 5) ++ ("id" -> foo) , I have to put id portion on the end because it's not going through the dsl. What I would like is something like

("id" [WHAT OP HERE?] foo.r) ++ ("someval" $gte 5)

How do i accomplish this? Please note that I know how to use "regular" ("foo" -> MongoDbObject(... syntax, I would like to use the dsl to do the same thing.

Thanks!

This isn't just an issue for regular expressions but for any fluid syntax that does an equality measure eg:

("name" -> "rozza") ++ ("forum" -> "stackoverflow")

This also fails, currently you have to wrap in a MongoDBObject instance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM