On 06 Dec 2011, at 17:14, Kausik Bakshi wrote:
I use mongoid for rails application
and I try to do
@users = User.where("first_name = ? OR last_name = ? OR type = ?",
firstname, lastname, usertype)
but I am getting error
but when i put:
@users = User.where(:first_name => firstname, :last_name => lastname,
:type => usertype).all
the program run successfully
but i need OR to execute in mongodb
Also I need sql LIKE to execute in mongodb
I have learned the raw code of mongodb
but I need a help for Rails query
Reading the documentation usually helps:
http://mongoid.org/docs/querying/criteria.html
Especially the "Model.any_of | Criteria#any_of" section seems to cover
your case.
Best regards
Peter De Berdt
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.