开发者

how to use regular expression in mongomodel for rails3

开发者 https://www.devze.com 2023-04-03 11:26 出处:网络
Hello I use rails3+mongodb+mongomodel but I have problem How to use regular expression search data in mongodb

Hello I use rails3+mongodb+mongomodel but I have problem

How to use regular expression search data in mongodb this code in controller

@article = Article.where('开发者_如何学JAVAtitle'=>'/Brown/i')

but it can not found data in database


With mongoid you pass a regexp as is, without quotes. Probably should work similarly for mongomodel:

Article.where('title'=>/Brown/i)
0

精彩评论

暂无评论...
验证码 换一张
取 消