Not equals in mongo mapper

安稳与你 提交于 2019-12-10 17:53:15

问题


I'm trying to run a query where I want to ignore records with a certain email address...

@foo = Bar.all(:email => 'xxx') <--- Except I want to negate where this email address exists.

Please let me know how I can do it.

Thanks!


回答1:


Or

@foo = Bar.all(:email.ne => 'xxx')




回答2:


Try:

@foo = Bar.all(:email => {"$ne" => "xxx"})



回答3:


@foo = Bar.all(:email => {"$ne" => "xxx"})



来源:https://stackoverflow.com/questions/3541528/not-equals-in-mongo-mapper

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