Not equal in mongo mapper

I am trying to run a query where I want to ignore entries with a specific email address ...

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

Please let me know how I can do this.

Thank!

+3
source share
3 answers

or

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

+9
source

Try:

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

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

0
source

Source: https://habr.com/ru/post/1760986/


All Articles