开发者

how to use regular expression in mongomodel for rails3

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜