MongoMapper OR clause on 2 columns - Rails 3.1.rc4

こ雲淡風輕ζ 提交于 2019-12-07 20:54:05

问题


How to perform something like this:

User.where("private = 1 OR beta = 0")

回答1:


See: http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24or

That translates to:

User.where(:$or => [{:private => 1}, {:beta => 0}])


来源:https://stackoverflow.com/questions/7175328/mongomapper-or-clause-on-2-columns-rails-3-1-rc4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!