I need to perform this sql query in rails console (I'm using mongodb):
SELECT * FROM Member WHERE name='x' OR age='42'
I need to perform this sql query in rails console (I'm using mongodb):
SELECT * FROM Member WHERE name='x' OR age='42'
For Mongoid I use 'any_of'. This should work:
Member.any_of({:name => x, :age => 42})
Also here's a link to some other queries you can use with mongoid. I don't see these in their main doc page:
You should start by reading the Active Record Query Interface RailsGuide, it'll answer your question, and probably teach you some other things you don't already know.