Reputation: 28164
I am a little stuck here (mongoid docs does not seem to give an answer)
Question.where(:text.contains=>"perfect")
I would like to find questions which text field contains a given word, in this case, perfect.
What is the correct query here, and how can i improve the performance of such queries?
Upvotes: 8
Views: 4227
Reputation: 4507
You should be able to use simple regex for that:
Question.where(:text => /perfect/)
Alex
Upvotes: 20